]> granicus.if.org Git - vim/commitdiff
patch 8.2.1862: vim9: memory leak when compiling lambda fails v8.2.1862
authorBram Moolenaar <Bram@vim.org>
Sun, 18 Oct 2020 21:32:13 +0000 (23:32 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 18 Oct 2020 21:32:13 +0000 (23:32 +0200)
Problem:    vim9: memory leak when compiling lambda fails.
Solution:   Call clear_evalarg().

src/version.c
src/vim9compile.c

index 5a5344315b4ac25cc10e3b4c69b43c63cf2f5da5..2e6bb9833c6c9f25d9bb34aaeec1503737e6af72 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1862,
 /**/
     1861,
 /**/
index edfa32566a7b51080a818816542c32a494c90ae8..55368d1b5cb2fbd5e4086e0510fda0556d3c1fb2 100644 (file)
@@ -2692,7 +2692,10 @@ compile_lambda(char_u **arg, cctx_T *cctx)
 
     // Get the funcref in "rettv".
     if (get_lambda_tv(arg, &rettv, &evalarg) != OK)
+    {
+       clear_evalarg(&evalarg, NULL);
        return FAIL;
+    }
 
     ufunc = rettv.vval.v_partial->pt_func;
     ++ufunc->uf_refcount;