patch 8.2.3001: Vim9: memory leak when compilation fails
Problem: Vim9: memory leak when compilation fails.
Solution: Free the list of variable names.
diff --git a/src/version.c b/src/version.c
index 3e33c5d..3696c2e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3001,
+/**/
3000,
/**/
2999,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 57e2311..8389399 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -9724,8 +9724,10 @@
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ ufunc->uf_dfunc_idx;
+ // Compiling aborted, free the generated instructions.
clear_instr_ga(instr);
VIM_CLEAR(dfunc->df_name);
+ ga_clear_strings(&dfunc->df_var_names);
// If using the last entry in the table and it was added above, we
// might as well remove it.