changeset 22627:1064b9f05b0a v8.2.1862

patch 8.2.1862: vim9: memory leak when compiling lambda fails Commit: https://github.com/vim/vim/commit/2ea79ad83584f5d668adfb935be67ee0e0e9995b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 18 23:32:13 2020 +0200 patch 8.2.1862: vim9: memory leak when compiling lambda fails Problem: vim9: memory leak when compiling lambda fails. Solution: Call clear_evalarg().
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Oct 2020 23:45:03 +0200
parents ea7853a71916
children 54b038a68b50
files src/version.c src/vim9compile.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1862,
+/**/
     1861,
 /**/
     1860,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2692,7 +2692,10 @@ compile_lambda(char_u **arg, cctx_T *cct
 
     // 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;