]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.746 v7.3.746
authorBram Moolenaar <Bram@vim.org>
Wed, 5 Dec 2012 14:16:47 +0000 (15:16 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 5 Dec 2012 14:16:47 +0000 (15:16 +0100)
Problem:    Memory leaks when using location lists.
Solution:   Set qf_title to something. (Christian Brabandt)

src/eval.c
src/quickfix.c
src/version.c

index aab9b0b4d426333463049530763c0a224993c287..76b41590d043e57567e3ebbfc100ee7a88e8c4a4 100644 (file)
@@ -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
index 2a485f0ad0b17cace4fa77fc1a38f026cabd9428..ac9366952b71394de884c4cca60e18fc56362046 100644 (file)
@@ -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;
index 8296bd49f3ab089469100fcd9960dd0c060bfc1d..411d55823f7d922c2bb228682a9dccd4802b39fa 100644 (file)
@@ -725,6 +725,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    746,
 /**/
     745,
 /**/