changeset 22369:62192fd08e0e v8.2.1733

patch 8.2.1733: Vim9: memory leaks when using nested function Commit: https://github.com/vim/vim/commit/4ee711f21389066fa157961feed17692fc16bf8e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 23 18:51:11 2020 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Sep 2020 19:00:04 +0200
parents 79a872530201
children 9a06648f05d3
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 */
 /**/
+    1733,
+/**/
     1732,
 /**/
     1731,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4408,7 +4408,10 @@ compile_nested_function(exarg_T *eap, cc
 	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)
     {