From 56931c4d89e7efe41dd96d230b8176e2d32a035d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 11 Jun 2024 11:19:17 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- revision.c | 1 + 1 file changed, 1 insertion(+) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 7ddf0f151a..af95502d92 100644 --- a/revision.c +++ b/revision.c @@ -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; -- cgit v1.2.3