changeset 20001:502a6c9b3974 v8.2.0556

patch 8.2.0556: Vim9: memory leak when finding common type Commit: https://github.com/vim/vim/commit/c5f1ef53c24cc0c9f7b2131609e916f913634feb Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 12 17:11:27 2020 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 12 Apr 2020 17:15:03 +0200
parents 87ecc4245e93
children 2bf41f30475c
files src/version.c src/vim9compile.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    556,
+/**/
     555,
 /**/
     554,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1823,8 +1823,8 @@ common_type(type_T *type1, type_T *type2
 		*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);