From 2ea79ad83584f5d668adfb935be67ee0e0e9995b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 18 Oct 2020 23:32:13 +0200 Subject: [PATCH] patch 8.2.1862: vim9: memory leak when compiling lambda fails Problem: vim9: memory leak when compiling lambda fails. Solution: Call clear_evalarg(). --- src/version.c | 2 ++ src/vim9compile.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/version.c b/src/version.c index 5a5344315..2e6bb9833 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1862, /**/ 1861, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index edfa32566..55368d1b5 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -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; -- 2.50.1