summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-27 22:03:50 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-27 22:03:50 +0200
commitd28cc3f55d4a5a980f6ac6fa682382822a223720 (patch)
treeafbd1226f742817a8a86a8d256587bf2a93a7daf /src/quickfix.c
parentab6eec3887d68c260b50b1b8f9ed95d49d9306c6 (diff)
downloadvim-git-d28cc3f55d4a5a980f6ac6fa682382822a223720.tar.gz
patch 8.0.0782: using freed memory in quickfix codev8.0.0782
Problem: Using freed memory in quickfix code. (Dominique Pelle) Solution: Handle a help window differently. (Yegappan Lakshmanan)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index c34e34d1c..79cb4168d 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2101,7 +2101,7 @@ qf_jump(
/*
* For ":helpgrep" find a help window or open one.
*/
- if (qf_ptr->qf_type == 1 && (!curwin->w_buffer->b_help || cmdmod.tab != 0))
+ if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) || cmdmod.tab != 0))
{
win_T *wp;
@@ -2109,7 +2109,7 @@ qf_jump(
wp = NULL;
else
FOR_ALL_WINDOWS(wp)
- if (wp->w_buffer != NULL && wp->w_buffer->b_help)
+ if (bt_help(wp->w_buffer))
break;
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
win_enter(wp, TRUE);
@@ -5343,10 +5343,14 @@ ex_helpgrep(exarg_T *eap)
if (eap->cmdidx == CMD_lhelpgrep)
{
- /* Find an existing help window */
- FOR_ALL_WINDOWS(wp)
- if (wp->w_buffer != NULL && wp->w_buffer->b_help)
- break;
+ /* If the current window is a help window, then use it */
+ if (bt_help(curwin->w_buffer))
+ wp = curwin;
+ else
+ /* Find an existing help window */
+ FOR_ALL_WINDOWS(wp)
+ if (bt_help(wp->w_buffer))
+ break;
if (wp == NULL) /* Help window not found */
qi = NULL;
@@ -5515,7 +5519,7 @@ ex_helpgrep(exarg_T *eap)
{
/* If the help window is not opened or if it already points to the
* correct location list, then free the new location list. */
- if (!curwin->w_buffer->b_help || curwin->w_llist == qi)
+ if (!bt_help(curwin->w_buffer) || curwin->w_llist == qi)
{
if (new_qi)
ll_free_all(&qi);