changeset 30578:f1010a0e6226 v9.0.0624

patch 9.0.0624: leaking argument type array Commit: https://github.com/vim/vim/commit/ac38ec7c7f7cb0ab94397dc19bd72b0a84afdbe5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 29 20:23:35 2022 +0100 patch 9.0.0624: leaking argument type array Problem: Leaking argument type array. Solution: Add allocated memory to type_gap.
author Bram Moolenaar <Bram@vim.org>
date Thu, 29 Sep 2022 21:30:03 +0200
parents a3b41eeccedf
children e298ce7862f7
files src/version.c src/vim9type.c
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    624,
+/**/
     623,
 /**/
     622,
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -58,13 +58,10 @@ copy_type(type_T *type, garray_T *type_g
 	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;
 }