]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.2406: Vim9: profiled :def function leaks memory v8.2.2406
authorBram Moolenaar <Bram@vim.org>
Sun, 24 Jan 2021 20:30:48 +0000 (21:30 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 24 Jan 2021 20:30:48 +0000 (21:30 +0100)
Problem:    Vim9: profiled :def function leaks memory.
Solution:   Delete the profiled instructions.

src/version.c
src/vim9compile.c

index 136448a3523a4bec66180beca9aa7cea1abc5b8f..5153086b021cbbcb27b1e95ac7a3aa748fedaa93 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2406,
 /**/
     2405,
 /**/
index 9497782ff94c3505b36e507d4dc95d94288125f2..2dd3a4ffec12343fdccd26b5134ffba5dbb71fcb 100644 (file)
@@ -8837,6 +8837,15 @@ delete_def_function_contents(dfunc_T *dfunc, int mark_deleted)
        VIM_CLEAR(dfunc->df_instr);
        dfunc->df_instr = NULL;
     }
+#ifdef FEAT_PROFILE
+    if (dfunc->df_instr_prof != NULL)
+    {
+       for (idx = 0; idx < dfunc->df_instr_prof_count; ++idx)
+           delete_instr(dfunc->df_instr_prof + idx);
+       VIM_CLEAR(dfunc->df_instr_prof);
+       dfunc->df_instr_prof = NULL;
+    }
+#endif
 
     if (mark_deleted)
        dfunc->df_deleted = TRUE;