vim-patch:8.1.0475: memory not freed on exit when quit in autocmd

Problem:    Memory not freed on exit when quit in autocmd.
Solution:   Remember funccal stack when executing autocmd.
27e80c885b
This commit is contained in:
erw7
2019-08-31 15:09:30 +09:00
parent f04a9a2c9a
commit 17f067f4b4
6 changed files with 63 additions and 37 deletions

View File

@@ -6736,7 +6736,6 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
static int nesting = 0;
AutoPatCmd patcmd;
AutoPat *ap;
void *save_funccalp;
char_u *save_cmdarg;
long save_cmdbang;
static int filechangeshell_busy = FALSE;
@@ -6926,8 +6925,9 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
if (do_profiling == PROF_YES)
prof_child_enter(&wait_time); /* doesn't count for the caller itself */
/* Don't use local function variables, if called from a function */
save_funccalp = save_funccal();
// Don't use local function variables, if called from a function.
funccal_entry_T funccal_entry;
save_funccal(&funccal_entry);
/*
* When starting to execute autocommands, save the search patterns.
@@ -7016,9 +7016,10 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
autocmd_bufnr = save_autocmd_bufnr;
autocmd_match = save_autocmd_match;
current_sctx = save_current_sctx;
restore_funccal(save_funccalp);
if (do_profiling == PROF_YES)
restore_funccal();
if (do_profiling == PROF_YES) {
prof_child_exit(&wait_time);
}
KeyTyped = save_KeyTyped;
xfree(fname);
xfree(sfname);