]> granicus.if.org Git - vim/commitdiff
patch 8.2.3001: Vim9: memory leak when compilation fails v8.2.3001
authorBram Moolenaar <Bram@vim.org>
Tue, 15 Jun 2021 09:27:21 +0000 (11:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 15 Jun 2021 09:27:21 +0000 (11:27 +0200)
Problem:    Vim9: memory leak when compilation fails.
Solution:   Free the list of variable names.

src/version.c
src/vim9compile.c

index 3e33c5d4c3b964bd854cba14f9ad0ffc72fc5e30..3696c2e2a81932024d45e35bed1d3ff4ba7af96a 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3001,
 /**/
     3000,
 /**/
index 57e2311ff5323390d4a68bad206630c3aaec1c05..83893992131dcaca89771cda62d5fbd897843e79 100644 (file)
@@ -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.