vim-patch:8.0.1413: accessing freed memory in :cbuffer

Problem:    Accessing freed memory in :cbuffer.
Solution:   Get quickfix list after executing autocmds. (closes vim/vim#2470)
aaf6e43b7a
This commit is contained in:
Jan Edmund Lazo
2018-08-15 00:27:03 -04:00
parent 0bdd4e8393
commit ee37a0c79a
2 changed files with 14 additions and 5 deletions

View File

@@ -4541,11 +4541,6 @@ void ex_cbuffer(exarg_T *eap)
qf_info_T *qi = &ql_info;
const char *au_name = NULL;
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
|| eap->cmdidx == CMD_laddbuffer) {
qi = ll_get_or_alloc_list(curwin);
}
switch (eap->cmdidx) {
case CMD_cbuffer:
au_name = "cbuffer";
@@ -4576,6 +4571,13 @@ void ex_cbuffer(exarg_T *eap)
}
}
// 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 (*eap->arg == NUL)
buf = curbuf;
else if (*skipwhite(skipdigits(eap->arg)) == NUL)