]> granicus.if.org Git - vim/commitdiff
patch 8.2.2989: Vim9: memory leak when debugging a :def function v8.2.2989
authorBram Moolenaar <Bram@vim.org>
Sun, 13 Jun 2021 13:39:00 +0000 (15:39 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 Jun 2021 13:39:00 +0000 (15:39 +0200)
Problem:    Vim9: memory leak when debugging a :def function.
Solution:   Free the debug instructions.

src/version.c
src/vim9compile.c

index 61a5f0d5c2ba21a0cacfe473b19a65c07390df61..ce78fc5e1f210598dea97069e55c64cac6b1608e 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2989,
 /**/
     2988,
 /**/
index 1747f30fd91efbf5215559ad88ade10c96dc6b61..be8f304528ebfda6cc5326ae5dcffc5730a1f6c8 100644 (file)
@@ -10045,6 +10045,13 @@ delete_def_function_contents(dfunc_T *dfunc, int mark_deleted)
        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)
     {