]> granicus.if.org Git - vim/commitdiff
patch 9.0.0624: leaking argument type array v9.0.0624
authorBram Moolenaar <Bram@vim.org>
Thu, 29 Sep 2022 19:23:35 +0000 (20:23 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 29 Sep 2022 19:23:35 +0000 (20:23 +0100)
Problem:    Leaking argument type array.
Solution:   Add allocated memory to type_gap.

src/version.c
src/vim9type.c

index bcc0b24be5aadd8b8939b5087b636c33f294e103..816dfb47f8f4e225b08a82e311a348926d6cd6b4 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    624,
 /**/
     623,
 /**/
index 6f205546d6e6b9f4d585f9801537b903c6448aad..c4aec7b19a053af8855bacf0027b9e2a75826e26 100644 (file)
@@ -58,13 +58,10 @@ copy_type(type_T *type, garray_T *type_gap)
        return type;
     *copy = *type;
 
-    if (type->tt_args != NULL)
-    {
-       copy->tt_args = ALLOC_MULT(type_T *, type->tt_argcount);
-       if (copy->tt_args != NULL)
-           for (int i = 0; i < type->tt_argcount; ++i)
-               copy->tt_args[i] = type->tt_args[i];
-    }
+    if (type->tt_args != NULL
+          && func_type_add_arg_types(copy, type->tt_argcount, type_gap) == OK)
+       for (int i = 0; i < type->tt_argcount; ++i)
+           copy->tt_args[i] = type->tt_args[i];
 
     return copy;
 }