Skip to content

Commit caf1a2f

Browse files
committed
patch 8.2.3001: Vim9: memory leak when compilation fails
Problem: Vim9: memory leak when compilation fails. Solution: Free the list of variable names.
1 parent 3b814af commit caf1a2f

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
3001,
753755
/**/
754756
3000,
755757
/**/

src/vim9compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9724,8 +9724,10 @@ compile_def_function(
97249724
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
97259725
+ ufunc->uf_dfunc_idx;
97269726

9727+
// Compiling aborted, free the generated instructions.
97279728
clear_instr_ga(instr);
97289729
VIM_CLEAR(dfunc->df_name);
9730+
ga_clear_strings(&dfunc->df_var_names);
97299731

97309732
// If using the last entry in the table and it was added above, we
97319733
// might as well remove it.

0 commit comments

Comments
 (0)