summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-09-23 01:34:50 +0200
committerJunio C Hamano <gitster@pobox.com>2017-09-24 10:05:51 +0900
commitcb7b29eb67772d08e2365ed07ede9d954d0344c1 (patch)
treef5eb5e520818e9290bc73e8684c55680886b8aa8 /commit.c
parentdd1055ed594f8fef18779cce3cd921c4ac66cf9c (diff)
downloadgit-cb7b29eb67772d08e2365ed07ede9d954d0344c1.tar.gz
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 <martin.agren@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index d3150d6270..f73976bcc9 100644
--- 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;
}