reduce_heads: fix memory leaks
We currently have seven callers of `reduce_heads(foo)`. Six of them do not use the original list `foo` again, and actually, all six of those end up leaking it. Introduce and use `reduce_heads_replace(&foo)` as a leak-free version of `foo = reduce_heads(foo)` to fix several of these. Fix the remaining leaks using `free_commit_list()`. While we're here, document `reduce_heads()` and mark it as `extern`. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a452d0f4ba
commit
4da72644b7
@ -571,7 +571,7 @@ static void find_merge_parents(struct merge_parents *result,
|
||||
head_commit = lookup_commit(head);
|
||||
if (head_commit)
|
||||
commit_list_insert(head_commit, &parents);
|
||||
parents = reduce_heads(parents);
|
||||
reduce_heads_replace(&parents);
|
||||
|
||||
while (parents) {
|
||||
struct commit *cmit = pop_commit(&parents);
|
||||
|
Reference in New Issue
Block a user