aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-08-31 15:09:30 +0900
committererw7 <erw7.github@gmail.com>2020-05-07 16:00:46 +0900
commit17f067f4b4799dde06be78f9b7c9e7c7d60900a2 (patch)
treec67ce740707feb31fe6bf55d8fbbd3ff3503d4ab /src/nvim/fileio.c
parentf04a9a2c9aa68f98a79b8d7e9917719a8be6049b (diff)
downloadrneovim-17f067f4b4799dde06be78f9b7c9e7c7d60900a2.tar.gz
rneovim-17f067f4b4799dde06be78f9b7c9e7c7d60900a2.tar.bz2
rneovim-17f067f4b4799dde06be78f9b7c9e7c7d60900a2.zip
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. https://github.com/vim/vim/commit/27e80c885bcb5c5cf6a6462d71d6c81b06ba2451
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 2335aba6dd..f29304867a 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -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);