diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2014-04-14 16:47:00 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-16 09:46:01 -0300 |
commit | cb0adf60de98003564105169dee4bc792c56a559 (patch) | |
tree | 92549d91a2d431fafffb2ac841459ac22d94d8c0 /src/fileio.c | |
parent | 40970917dcd35c8e986c3dc678bf180a2b2ddf24 (diff) | |
download | rneovim-cb0adf60de98003564105169dee4bc792c56a559.tar.gz rneovim-cb0adf60de98003564105169dee4bc792c56a559.tar.bz2 rneovim-cb0adf60de98003564105169dee4bc792c56a559.zip |
vim-patch:7.4.251
Problem: Crash when BufAdd autocommand wipes out the buffer.
Solution: Check for buffer to still be valid. Postpone freeing the
buffer structure. (Hirohito Higashi)
https://code.google.com/p/vim/source/detail?r=29eb4c2a33ac701bfcd4d2e2bed7864eba876e0e
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c index fb9f0e0cea..68b68ef3ed 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7525,14 +7525,17 @@ apply_autocmds_group ( vim_free(sfname); --nesting; /* see matching increment above */ - /* - * When stopping to execute autocommands, restore the search patterns and - * the redo buffer. - */ + // When stopping to execute autocommands, restore the search patterns and + // the redo buffer. Free buffers in the au_pending_free_buf list. if (!autocmd_busy) { restore_search_patterns(); restoreRedobuff(); did_filetype = FALSE; + while (au_pending_free_buf != NULL) { + buf_T *b = au_pending_free_buf->b_next; + vim_free(au_pending_free_buf); + au_pending_free_buf = b; + } } /* |