diff src/vim9compile.c @ 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 6c3d15011081
children 15003353a464
line wrap: on
line diff
--- 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)
     {