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 #2473)
diff --git a/src/quickfix.c b/src/quickfix.c
index 87c6085..5deaed5 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4068,10 +4068,6 @@
#endif
int res;
- if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
- || eap->cmdidx == CMD_laddfile)
- wp = curwin;
-
#ifdef FEAT_AUTOCMD
switch (eap->cmdidx)
{
@@ -4104,6 +4100,11 @@
if (*eap->arg != NUL)
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);
+ 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.