]> granicus.if.org Git - vim/commitdiff
patch 7.4.989 v7.4.989
authorBram Moolenaar <Bram@vim.org>
Mon, 28 Dec 2015 21:51:20 +0000 (22:51 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 28 Dec 2015 21:51:20 +0000 (22:51 +0100)
Problem:    Leaking memory when hash_add() fails. Coverity error 99126.
Solution:   When hash_add() fails free the memory.

src/eval.c
src/version.c

index a2d2939ba236f615e232c2fd954871a7bed8c9bc..eca8224ebf0e12686ed1f4b31fae5eacadaee1be 100644 (file)
@@ -23095,7 +23095,11 @@ ex_function(eap)
 
        /* insert the new function in the function list */
        STRCPY(fp->uf_name, name);
-       hash_add(&func_hashtab, UF2HIKEY(fp));
+       if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL)
+       {
+           vim_free(fp);
+           goto erret;
+       }
     }
     fp->uf_args = newargs;
     fp->uf_lines = newlines;
index fcc22cd846acb744e28d7153884922f18fa3a9ba..ddf260bbfd374fda773f8994ce7190cf957115ad 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    989,
 /**/
     988,
 /**/