0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.3.746

Problem:    Memory leaks when using location lists.
Solution:   Set qf_title to something. (Christian Brabandt)
This commit is contained in:
Bram Moolenaar
2012-12-05 15:16:47 +01:00
parent 15d55dec03
commit 81484f4215
3 changed files with 12 additions and 2 deletions

View 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;