changeset 24903:99324f6b535a v8.2.2989

patch 8.2.2989: Vim9: memory leak when debugging a :def function Commit: https://github.com/vim/vim/commit/c2dec4cac4087af90dd4f64f4912a8e14a5fdd56 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 13 15:39:00 2021 +0200 patch 8.2.2989: Vim9: memory leak when debugging a :def function Problem: Vim9: memory leak when debugging a :def function. Solution: Free the debug instructions.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jun 2021 15:45:02 +0200
parents c101db2e0470
children ff16ad911fdb
files src/version.c src/vim9compile.c
diffstat 2 files changed, 9 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 */
 /**/
+    2989,
+/**/
     2988,
 /**/
     2987,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -10045,6 +10045,13 @@ delete_def_function_contents(dfunc_T *df
 	VIM_CLEAR(dfunc->df_instr);
 	dfunc->df_instr = NULL;
     }
+    if (dfunc->df_instr_debug != NULL)
+    {
+	for (idx = 0; idx < dfunc->df_instr_debug_count; ++idx)
+	    delete_instr(dfunc->df_instr_debug + idx);
+	VIM_CLEAR(dfunc->df_instr_debug);
+	dfunc->df_instr_debug = NULL;
+    }
 #ifdef FEAT_PROFILE
     if (dfunc->df_instr_prof != NULL)
     {