comparison src/vim9compile.c @ 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 e20d34db7cf4
children 345619f35112
comparison
equal deleted inserted replaced
24927:101755874b79 24928:cf4bc18a3931
9722 if (ufunc->uf_def_status == UF_COMPILING) 9722 if (ufunc->uf_def_status == UF_COMPILING)
9723 { 9723 {
9724 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) 9724 dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
9725 + ufunc->uf_dfunc_idx; 9725 + ufunc->uf_dfunc_idx;
9726 9726
9727 // Compiling aborted, free the generated instructions.
9727 clear_instr_ga(instr); 9728 clear_instr_ga(instr);
9728 VIM_CLEAR(dfunc->df_name); 9729 VIM_CLEAR(dfunc->df_name);
9730 ga_clear_strings(&dfunc->df_var_names);
9729 9731
9730 // If using the last entry in the table and it was added above, we 9732 // If using the last entry in the table and it was added above, we
9731 // might as well remove it. 9733 // might as well remove it.
9732 if (!dfunc->df_deleted && new_def_function 9734 if (!dfunc->df_deleted && new_def_function
9733 && ufunc->uf_dfunc_idx == def_functions.ga_len - 1) 9735 && ufunc->uf_dfunc_idx == def_functions.ga_len - 1)