aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-05 23:18:11 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-06-06 22:43:47 -0400
commit0234d579a72a81349901c7ec4f7bca6b4bc6f132 (patch)
tree17c524ed6ce4275204cdf51d3a1395f78c83c4f3 /src/nvim/quickfix.c
parent427140048b7cc8b48bdd53683247513acefb77ba (diff)
downloadrneovim-0234d579a72a81349901c7ec4f7bca6b4bc6f132.tar.gz
rneovim-0234d579a72a81349901c7ec4f7bca6b4bc6f132.tar.bz2
rneovim-0234d579a72a81349901c7ec4f7bca6b4bc6f132.zip
vim-patch:8.0.1414: accessing freed memory in :lfile.
Problem: Accessing freed memory in :lfile. Solution: Get the current window after executing autocommands. (Yegappan Lakshmanan, closes vim/vim#2473) https://github.com/vim/vim/commit/14a4deb064610c30a50f00d524dde9b3292aad59
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 47b8e4a3e0..3c3925c169 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3767,10 +3767,6 @@ void ex_cfile(exarg_T *eap)
qf_info_T *qi = &ql_info;
char_u *au_name = NULL;
- if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
- || eap->cmdidx == CMD_laddfile)
- wp = curwin;
-
switch (eap->cmdidx) {
case CMD_cfile: au_name = (char_u *)"cfile"; break;
case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break;
@@ -3786,6 +3782,13 @@ void ex_cfile(exarg_T *eap)
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);
char_u *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
+
+ if (eap->cmdidx == CMD_lfile
+ || eap->cmdidx == CMD_lgetfile
+ || eap->cmdidx == CMD_laddfile) {
+ wp = curwin;
+ }
+
// This function is used by the :cfile, :cgetfile and :caddfile
// commands.
// :cfile always creates a new quickfix list and jumps to the