]> granicus.if.org Git - vim/commitdiff
patch 8.2.0556: Vim9: memory leak when finding common type v8.2.0556
authorBram Moolenaar <Bram@vim.org>
Sun, 12 Apr 2020 15:11:27 +0000 (17:11 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 12 Apr 2020 15:11:27 +0000 (17:11 +0200)
Problem:    Vim9: memory leak when finding common type.
Solution:   Store allocated memory in type growarray.

src/version.c
src/vim9compile.c

index 375ae6dbb74ddbb3a38aa0f7ab6ba5dc86932145..7095794e1b006b7208d17bc4b9579b3f700891d2 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    556,
 /**/
     555,
 /**/
index 8d536eb08965695948ba301f77f557d393e519fc..cf91d3bb37649daff1be19e3b620df0a6eb3e66a 100644 (file)
@@ -1823,8 +1823,8 @@ common_type(type_T *type1, type_T *type2, type_T **dest, garray_T *type_gap)
                *dest = alloc_func_type(common, argcount, type_gap);
                if (type1->tt_args != NULL && type2->tt_args != NULL)
                {
-                   (*dest)->tt_args = ALLOC_CLEAR_MULT(type_T *, argcount);
-                   if ((*dest)->tt_args != NULL)
+                   if (func_type_add_arg_types(*dest, argcount,
+                                                            type_gap) == OK)
                        for (i = 0; i < argcount; ++i)
                            common_type(type1->tt_args[i], type2->tt_args[i],
                                               &(*dest)->tt_args[i], type_gap);