patch 8.2.1711: Vim9: leaking memory when using partial
Problem: Vim9: leaking memory when using partial.
Solution: Do delete the function even when it was compiled.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index e4ccaaa..cd6eff5 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -270,12 +270,18 @@
{
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ ectx->ec_dfunc_idx;
- int argcount = ufunc_argcount(dfunc->df_ufunc);
- int top = ectx->ec_frame_idx - argcount;
+ int argcount;
+ int top;
int idx;
typval_T *tv;
int closure_in_use = FALSE;
+ if (dfunc->df_ufunc == NULL)
+ // function was freed
+ return OK;
+ argcount = ufunc_argcount(dfunc->df_ufunc);
+ top = ectx->ec_frame_idx - argcount;
+
// Check if any created closure is still in use.
for (idx = 0; idx < dfunc->df_closure_count; ++idx)
{