commit: fix memory leak in `reduce_heads()`
authorMartin Ågren <martin.agren@gmail.com>
Fri, 22 Sep 2017 23:34:50 +0000 (01:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Sep 2017 01:05:51 +0000 (10:05 +0900)
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 <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c

index d3150d6..f73976b 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1080,6 +1080,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
        num_head = remove_redundant(array, num_head);
        for (i = 0; i < num_head; i++)
                tail = &commit_list_insert(array[i], tail)->next;
+       free(array);
        return result;
 }