aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-15 00:27:03 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-15 01:27:30 -0400
commitee37a0c79ae61931b15570ed1877779dc7bd0dad (patch)
tree0b04e24785bb328053310c77428d9adc7b3f5679 /src/nvim/quickfix.c
parent0bdd4e8393636ad7c7d013df4c361264b1c048f1 (diff)
downloadrneovim-ee37a0c79ae61931b15570ed1877779dc7bd0dad.tar.gz
rneovim-ee37a0c79ae61931b15570ed1877779dc7bd0dad.tar.bz2
rneovim-ee37a0c79ae61931b15570ed1877779dc7bd0dad.zip
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) https://github.com/vim/vim/commit/aaf6e43b7a99cedb89d73ba749a46f7a0f16bbb6
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 4308c4e87e..a19e98725a 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -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)