changeset 23082:2120e4b40e12 v8.2.2087

patch 8.2.2087: Vim9: memory leak when statement is truncated Commit: https://github.com/vim/vim/commit/21e51221f2c4f301912a5d59c748351b02c3df9e Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 4 12:43:29 2020 +0100 patch 8.2.2087: Vim9: memory leak when statement is truncated Problem: Vim9: memory leak when statement is truncated. Solution: Increment the number of local variables.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Dec 2020 12:45:04 +0100
parents 8352e4d605ed
children 20de8e0ba195
files src/version.c src/vim9compile.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 */
 /**/
+    2087,
+/**/
     2086,
 /**/
     2085,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5669,7 +5669,11 @@ compile_assignment(char_u *arg, exarg_T 
 		    wp = op + oplen;
 		    p = skipwhite(wp);
 		    if (may_get_next_line_error(wp, &p, cctx) == FAIL)
+		    {
+			if (new_local)
+			    ++cctx->ctx_locals.ga_len;
 			goto theend;
+		    }
 		    r = compile_expr0_ext(&p, cctx, &is_const);
 		    if (new_local)
 			++cctx->ctx_locals.ga_len;