mirror of
https://github.com/git/git
synced 2024-10-02 14:45:21 +00:00
commit-reach(paint_down_to_common): plug two memory leaks
When a commit is missing, we return early (currently pretending that no merge basis could be found in that case). At that stage, it is possible that a merge base could have been found already, and added to the `result`, which is now leaked. The priority queue has a similar issue: There might still be a commit in that queue. Let's release both, to address the potential memory leaks. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f41f85c9ec
commit
e67431d496
|
@ -104,8 +104,11 @@ static struct commit_list *paint_down_to_common(struct repository *r,
|
||||||
parents = parents->next;
|
parents = parents->next;
|
||||||
if ((p->object.flags & flags) == flags)
|
if ((p->object.flags & flags) == flags)
|
||||||
continue;
|
continue;
|
||||||
if (repo_parse_commit(r, p))
|
if (repo_parse_commit(r, p)) {
|
||||||
|
clear_prio_queue(&queue);
|
||||||
|
free_commit_list(result);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
p->object.flags |= flags;
|
p->object.flags |= flags;
|
||||||
prio_queue_put(&queue, p);
|
prio_queue_put(&queue, p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue