From 4ee711f21389066fa157961feed17692fc16bf8e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 23 Sep 2020 18:51:11 +0200 Subject: [PATCH] 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. --- src/version.c | 2 ++ src/vim9compile.c | 3 +++ 2 files changed, 5 insertions(+) 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) { -- 2.50.1