summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-15 11:27:21 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-15 11:27:21 +0200
commitcaf1a2f296499bdcf030aca545a04da65ac210a1 (patch)
tree517a577affee36cfd5df2c553e57149144ace7ca
parent3b814af7e1e7ca18fe1c8c671b18e5e8c1f9e94c (diff)
patch 8.2.3001: Vim9: memory leak when compilation failsv8.2.3001
Problem: Vim9: memory leak when compilation fails. Solution: Free the list of variable names.
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/version.c b/src/version.c
index 3e33c5d4c3..3696c2e2a8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
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 57e2311ff5..8389399213 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -9724,8 +9724,10 @@ erret:
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.