Skip to content

Commit 3f32866

Browse files
committed
updated for version 7.3.746
Problem: Memory leaks when using location lists. Solution: Set qf_title to something. (Christian Brabandt)
1 parent 43afd98 commit 3f32866

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/eval.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16292,7 +16292,8 @@ set_qf_ll_list(wp, list_arg, action_arg, rettv)
1629216292
action = *act;
1629316293
}
1629416294

16295-
if (l != NULL && set_errorlist(wp, l, action, NULL) == OK)
16295+
if (l != NULL && set_errorlist(wp, l, action,
16296+
(char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
1629616297
rettv->vval.v_number = 0;
1629716298
}
1629816299
#endif

src/quickfix.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,15 +2124,22 @@ qf_free(qi, idx)
21242124
int idx;
21252125
{
21262126
qfline_T *qfp;
2127+
int stop = FALSE;
21272128

21282129
while (qi->qf_lists[idx].qf_count)
21292130
{
21302131
qfp = qi->qf_lists[idx].qf_start->qf_next;
2131-
if (qi->qf_lists[idx].qf_title != NULL)
2132+
if (qi->qf_lists[idx].qf_title != NULL && !stop)
21322133
{
21332134
vim_free(qi->qf_lists[idx].qf_start->qf_text);
2135+
stop = (qi->qf_lists[idx].qf_start == qfp);
21342136
vim_free(qi->qf_lists[idx].qf_start->qf_pattern);
21352137
vim_free(qi->qf_lists[idx].qf_start);
2138+
if (stop)
2139+
/* Somehow qf_count may have an incorrect value, set it to 1
2140+
* to avoid crashing when it's wrong.
2141+
* TODO: Avoid qf_count being incorrect. */
2142+
qi->qf_lists[idx].qf_count = 1;
21362143
}
21372144
qi->qf_lists[idx].qf_start = qfp;
21382145
--qi->qf_lists[idx].qf_count;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,8 @@ static char *(features[]) =
725725

726726
static int included_patches[] =
727727
{ /* Add new patch number below this line */
728+
/**/
729+
746,
728730
/**/
729731
745,
730732
/**/

0 commit comments

Comments
 (0)