From: Bram Moolenaar Date: Wed, 23 Sep 2020 16:51:11 +0000 (+0200) Subject: patch 8.2.1733: Vim9: memory leaks when using nested function X-Git-Tag: v8.2.1733 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ee711f21389066fa157961feed17692fc16bf8e;p=vim patch 8.2.1733: Vim9: memory leaks when using nested function Problem: Vim9: memory leaks when using nested function. Solution: Free function when compilation fails. --- diff --git a/src/version.c b/src/version.c index e3d61eb99..033a34b10 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 */ +/**/ + 1733, /**/ 1732, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index 06ee2f5a8..2b93dea82 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -4408,7 +4408,10 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx) return eap->skip ? (char_u *)"" : NULL; if (ufunc->uf_def_status == UF_TO_BE_COMPILED && compile_def_function(ufunc, TRUE, cctx) == FAIL) + { + func_ptr_unref(ufunc); return NULL; + } if (is_global) {