patch 8.2.2989: Vim9: memory leak when debugging a :def function
Problem: Vim9: memory leak when debugging a :def function.
Solution: Free the debug instructions.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 1747f30..be8f304 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -10045,6 +10045,13 @@
VIM_CLEAR(dfunc->df_instr);
dfunc->df_instr = NULL;
}
+ if (dfunc->df_instr_debug != NULL)
+ {
+ for (idx = 0; idx < dfunc->df_instr_debug_count; ++idx)
+ delete_instr(dfunc->df_instr_debug + idx);
+ VIM_CLEAR(dfunc->df_instr_debug);
+ dfunc->df_instr_debug = NULL;
+ }
#ifdef FEAT_PROFILE
if (dfunc->df_instr_prof != NULL)
{