| To: vim_dev@googlegroups.com |
| Subject: Patch 7.3.746 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.3.746 |
| Problem: Memory leaks when using location lists. |
| Solution: Set qf_title to something. (Christian Brabandt) |
| Files: src/eval.c, src/quickfix.c |
| |
| |
| |
| |
| |
| *** 16292,16298 **** |
| action = *act; |
| } |
| |
| ! if (l != NULL && set_errorlist(wp, l, action, NULL) == OK) |
| rettv->vval.v_number = 0; |
| } |
| #endif |
| --- 16292,16299 ---- |
| action = *act; |
| } |
| |
| ! if (l != NULL && set_errorlist(wp, l, action, |
| ! (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK) |
| rettv->vval.v_number = 0; |
| } |
| #endif |
| |
| |
| |
| *** 2124,2138 **** |
| int idx; |
| { |
| qfline_T *qfp; |
| |
| while (qi->qf_lists[idx].qf_count) |
| { |
| qfp = qi->qf_lists[idx].qf_start->qf_next; |
| ! if (qi->qf_lists[idx].qf_title != NULL) |
| { |
| vim_free(qi->qf_lists[idx].qf_start->qf_text); |
| vim_free(qi->qf_lists[idx].qf_start->qf_pattern); |
| vim_free(qi->qf_lists[idx].qf_start); |
| } |
| qi->qf_lists[idx].qf_start = qfp; |
| --qi->qf_lists[idx].qf_count; |
| --- 2124,2145 ---- |
| 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 && !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; |
| |
| |
| |
| *** 727,728 **** |
| --- 727,730 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 746, |
| /**/ |
| |
| -- |
| hundred-and-one symptoms of being an internet addict: |
| 98. The Alta Vista administrators ask you what sites are missing |
| in their index files. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |