patch 8.2.0556: Vim9: memory leak when finding common type
Problem: Vim9: memory leak when finding common type.
Solution: Store allocated memory in type growarray.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 8d536eb..cf91d3b 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1823,8 +1823,8 @@
*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);