[PATCH v2 2/6] commit: fix memory leak in `reduce_heads()`
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Sep 22, 2017, 23:34 UTC
- Message-ID
- <75117f05084a342ec5dd53d613cfaf2fbfb13054.1506120292.git.martin.agren@gmail.com>
- In-Reply-To
- <cover.1506120291.git.martin.agren@gmail.com>
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 | 1 + 1 file changed, 1 insertion(+)
diff --git a/commit.c b/commit.c index d3150d627..f73976bcc 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; }
-- 2.14.1.727.g9ddaf86