Skip to content

Commit cb7b29e

Browse files
Martin Ågrengitster
authored andcommitted
commit: fix memory leak in reduce_heads()
We don't free the temporary scratch space we use with `remove_redundant()`. Free it similar to how we do it in `get_merge_bases_many_0()`. Signed-off-by: Martin Ågren <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dd1055e commit cb7b29e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

commit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
10801080
num_head = remove_redundant(array, num_head);
10811081
for (i = 0; i < num_head; i++)
10821082
tail = &commit_list_insert(array[i], tail)->next;
1083+
free(array);
10831084
return result;
10841085
}
10851086

0 commit comments

Comments
 (0)