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.
diff --git a/src/version.c b/src/version.c
index eb5a8e2..3517510 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2087,
+/**/
2086,
/**/
2085,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 7464fc1..4b8a8ad 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5669,7 +5669,11 @@
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;