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/vim9compile.c b/src/vim9compile.c
index 06ee2f5..2b93dea 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4408,7 +4408,10 @@
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)
{