]> granicus.if.org Git - vim/commitdiff
patch 8.2.0821: Vim9: memory leak in expr test v8.2.0821
authorBram Moolenaar <Bram@vim.org>
Sun, 24 May 2020 22:28:33 +0000 (00:28 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 24 May 2020 22:28:33 +0000 (00:28 +0200)
Problem:    Vim9: memory leak in expr test.
Solution:   Do not decrement the length of the list of functions if the
            current function is not at the end.

src/version.c
src/vim9compile.c

index a1e4a7f4876cb9673e5faf1c82fdd1018fe02e4f..2d99068b09a9ae54d3fcca9454d7b4bd4a37ea0f 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    821,
 /**/
     820,
 /**/
index 7d302da83a17d19941390f305270a0c385e442ea..5adea9f7e096c2507d5e7c7b2b67042bd228ed2c 100644 (file)
@@ -1443,7 +1443,7 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufunc, int pushed_argcount)
            }
        }
        if (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED)
-           if (compile_def_function(ufunc, TRUE, cctx) == FAIL)
+           if (compile_def_function(ufunc, TRUE, NULL) == FAIL)
                return FAIL;
     }
 
@@ -6776,9 +6776,11 @@ erret:
            delete_instr(((isn_T *)instr->ga_data) + idx);
        ga_clear(instr);
 
-       ufunc->uf_dfunc_idx = UF_NOT_COMPILED;
-       if (!dfunc->df_deleted)
+       // if using the last entry in the table we might as well remove it
+       if (!dfunc->df_deleted
+                           && ufunc->uf_dfunc_idx == def_functions.ga_len - 1)
            --def_functions.ga_len;
+       ufunc->uf_dfunc_idx = UF_NOT_COMPILED;
 
        while (cctx.ctx_scope != NULL)
            drop_scope(&cctx);