Mercurial > vim
changeset 13076:7c071a3f7f8e v8.0.1413
patch 8.0.1413: accessing freed memory in :cbuffer
commit https://github.com/vim/vim/commit/aaf6e43b7a99cedb89d73ba749a46f7a0f16bbb6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 19 16:41:14 2017 +0100
patch 8.0.1413: accessing freed memory in :cbuffer
Problem: Accessing freed memory in :cbuffer.
Solution: Get quickfix list after executing autocmds. (closes https://github.com/vim/vim/issues/2470)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2017 16:45:06 +0100 |
parents | d25c0dfb3ec6 |
children | 519ff3efa2e2 |
files | src/quickfix.c src/testdir/test_autocmd.vim src/version.c |
diffstat | 3 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -5520,14 +5520,6 @@ ex_cbuffer(exarg_T *eap) #endif int res; - if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer - || eap->cmdidx == CMD_laddbuffer) - { - qi = ll_get_or_alloc_list(curwin); - if (qi == NULL) - return; - } - #ifdef FEAT_AUTOCMD switch (eap->cmdidx) { @@ -5549,6 +5541,15 @@ ex_cbuffer(exarg_T *eap) } #endif + /* Must come after autocommands. */ + if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer + || eap->cmdidx == CMD_laddbuffer) + { + qi = ll_get_or_alloc_list(curwin); + if (qi == NULL) + return; + } + if (*eap->arg == NUL) buf = curbuf; else if (*skipwhite(skipdigits(eap->arg)) == NUL)