]> granicus.if.org Git - vim/commitdiff
patch 8.2.2087: Vim9: memory leak when statement is truncated v8.2.2087
authorBram Moolenaar <Bram@vim.org>
Fri, 4 Dec 2020 11:43:29 +0000 (12:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 4 Dec 2020 11:43:29 +0000 (12:43 +0100)
Problem:    Vim9: memory leak when statement is truncated.
Solution:   Increment the number of local variables.

src/version.c
src/vim9compile.c

index eb5a8e228a84de9269b19f6980e1078ff23efb02..3517510bbcfab44289bca08c472bc8880c0bb9b3 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2087,
 /**/
     2086,
 /**/
index 7464fc1f94356ae9f2acbe028f0de173dd59edd4..4b8a8ad7177cdea1d52ea0ee8214113ddd7d8ecb 100644 (file)
@@ -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;