summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-12-05 15:16:47 +0100
committerBram Moolenaar <Bram@vim.org>2012-12-05 15:16:47 +0100
commit81484f421553639a719db996bb83e52ea43792c9 (patch)
treeaf24a5fcf53a8689eee72381c4b46a7d9e3286c7
parent15d55dec03eca3ae87d245f23fad086a501d7f07 (diff)
downloadvim-git-81484f421553639a719db996bb83e52ea43792c9.tar.gz
updated for version 7.3.746v7.3.746
Problem: Memory leaks when using location lists. Solution: Set qf_title to something. (Christian Brabandt)
-rw-r--r--src/eval.c3
-rw-r--r--src/quickfix.c9
-rw-r--r--src/version.c2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index aab9b0b4d..76b41590d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -16292,7 +16292,8 @@ set_qf_ll_list(wp, list_arg, action_arg, rettv)
action = *act;
}
- if (l != NULL && set_errorlist(wp, l, action, NULL) == OK)
+ if (l != NULL && set_errorlist(wp, l, action,
+ (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
rettv->vval.v_number = 0;
}
#endif
diff --git a/src/quickfix.c b/src/quickfix.c
index 2a485f0ad..ac9366952 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2124,15 +2124,22 @@ qf_free(qi, idx)
int idx;
{
qfline_T *qfp;
+ int stop = FALSE;
while (qi->qf_lists[idx].qf_count)
{
qfp = qi->qf_lists[idx].qf_start->qf_next;
- if (qi->qf_lists[idx].qf_title != NULL)
+ if (qi->qf_lists[idx].qf_title != NULL && !stop)
{
vim_free(qi->qf_lists[idx].qf_start->qf_text);
+ stop = (qi->qf_lists[idx].qf_start == qfp);
vim_free(qi->qf_lists[idx].qf_start->qf_pattern);
vim_free(qi->qf_lists[idx].qf_start);
+ if (stop)
+ /* Somehow qf_count may have an incorrect value, set it to 1
+ * to avoid crashing when it's wrong.
+ * TODO: Avoid qf_count being incorrect. */
+ qi->qf_lists[idx].qf_count = 1;
}
qi->qf_lists[idx].qf_start = qfp;
--qi->qf_lists[idx].qf_count;
diff --git a/src/version.c b/src/version.c
index 8296bd49f..411d55823 100644
--- a/src/version.c
+++ b/src/version.c
@@ -726,6 +726,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 746,
+/**/
745,
/**/
744,