# HG changeset patch # User Bram Moolenaar # Date 1354717007 -3600 # Node ID 4934eb2e22dc0bc03fd5d4f95706a69a1ddffb94 # Parent b97ab967c4fb88023861ef458b9b9ad6fc1704a0 updated for version 7.3.746 Problem: Memory leaks when using location lists. Solution: Set qf_title to something. (Christian Brabandt) diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -16292,7 +16292,8 @@ set_qf_ll_list(wp, list_arg, action_arg, 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 --- 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 --- 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,