changeset 24928:cf4bc18a3931 v8.2.3001

patch 8.2.3001: Vim9: memory leak when compilation fails Commit: https://github.com/vim/vim/commit/caf1a2f296499bdcf030aca545a04da65ac210a1 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 15 11:27:21 2021 +0200 patch 8.2.3001: Vim9: memory leak when compilation fails Problem: Vim9: memory leak when compilation fails. Solution: Free the list of variable names.
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Jun 2021 11:30:03 +0200
parents 101755874b79
children 1ede0f0ab8d9
files src/version.c src/vim9compile.c
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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.