changeset 23110:545ff3b4543c v8.2.2101

patch 8.2.2101: Vim9: memory leak when literal dict has an error Commit: https://github.com/vim/vim/commit/8bb0f5472c740458708fd3edabbb8d5193a96241 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 6 16:03:55 2020 +0100 patch 8.2.2101: Vim9: memory leak when literal dict has an error Problem: Vim9: memory leak when literal dict has an error and when an expression is not complete. Solution: Clear the typval and the growarray.
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Dec 2020 16:15:03 +0100
parents 7b0be0967a82
children e0c700860400
files src/dict.c src/version.c src/vim9compile.c
diffstat 3 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -929,6 +929,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 		if (**arg != ']')
 		{
 		    emsg(_(e_missing_matching_bracket_after_dict_key));
+		    clear_tv(&tvkey);
 		    return FAIL;
 		}
 		++*arg;
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2101,
+/**/
     2100,
 /**/
     2099,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4392,7 +4392,10 @@ compile_and_or(
 	    // eval the next expression
 	    *arg = skipwhite(p + 2);
 	    if (may_get_next_line_error(p + 2, arg, cctx) == FAIL)
+	    {
+		ga_clear(&end_ga);
 		return FAIL;
+	    }
 
 	    if ((opchar == '|' ? compile_expr3(arg, cctx, ppconst)
 				  : compile_expr4(arg, cctx, ppconst)) == FAIL)