commit: fix memory leak in `reduce_heads()`
PATCH 1/1 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]>
--- commit.c | 1 + 1 file changed, 1 insertion(+)
commit.c +1 -0
@@ -1086,6 +1086,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; }
Signature · 1 line
2.14.1
Quoted 3 lines · Martin Ågren
We don't free the temporary scratch space we use with
remove_redundant(). Free it similar to how we do it inget_merge_bases_many_0().
Yep, seems very straightforward, and there are no code paths where we wouldn't want this.
-Peff
Quoted 8 lines · Martin Ågren
We don't free the temporary scratch space we use with
remove_redundant(). Free it similar to how we do it inget_merge_bases_many_0().Signed-off-by Martin Ågren <[email protected]>--- commit.c | 1 + 1 file changed, 1 insertion(+)
Good catch. Thanks.
Reviewed-by Jonathan Nieder <[email protected]>