summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-29 20:23:35 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-29 20:23:35 +0100
commitac38ec7c7f7cb0ab94397dc19bd72b0a84afdbe5 (patch)
tree59c615034920c524806897a980569e5e80499968
parentfa1039760e8c1a0c7a2a722160bd3d71a4736e61 (diff)
patch 9.0.0624: leaking argument type arrayv9.0.0624
Problem: Leaking argument type array. Solution: Add allocated memory to type_gap.
-rw-r--r--src/version.c2
-rw-r--r--src/vim9type.c11
2 files changed, 6 insertions, 7 deletions
diff --git a/src/version.c b/src/version.c
index bcc0b24be5..816dfb47f8 100644
--- 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,
diff --git a/src/vim9type.c b/src/vim9type.c
index 6f205546d6..c4aec7b19a 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -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;
}