revision: fix memory leak when reversing revisions
When reversing revisions in a rev walk, `get_revision()` will allocate a new commit list and assign it to `revs->commits`. It does not free the old list though, which makes it leak. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
03b0e7d3a7
commit
56931c4d89
@ -4430,6 +4430,7 @@ struct commit *get_revision(struct rev_info *revs)
|
||||
reversed = NULL;
|
||||
while ((c = get_revision_internal(revs)))
|
||||
commit_list_insert(c, &reversed);
|
||||
free_commit_list(revs->commits);
|
||||
revs->commits = reversed;
|
||||
revs->reverse = 0;
|
||||
revs->reverse_output_stage = 1;
|
||||
|
||||
Reference in New Issue
Block a user