From 21e51221f2c4f301912a5d59c748351b02c3df9e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 4 Dec 2020 12:43:29 +0100 Subject: 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. --- src/version.c | 2 ++ src/vim9compile.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/version.c b/src/version.c index eb5a8e228..3517510bb 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2087, /**/ 2086, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index 7464fc1f9..4b8a8ad71 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -5669,7 +5669,11 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx) 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; -- cgit v1.2.1