patch 8.2.1862: vim9: memory leak when compiling lambda fails
Problem: vim9: memory leak when compiling lambda fails.
Solution: Call clear_evalarg().
diff --git a/src/version.c b/src/version.c
index 5a53443..2e6bb98 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1862,
+/**/
1861,
/**/
1860,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index edfa325..55368d1 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2692,7 +2692,10 @@
// 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;