From: René Scharfe Date: Sat, 03 Jun 2023 06:02:51 GMT Subject: Re: [PATCH] Fix memory leak in get_reachable_subset Message-ID: <21d3f105-ed32-e397-a1fe-53344894bd44@web.de> In-Reply-To: Am 03.06.23 um 04:02 schrieb Junio C Hamano: > Mike Hommey writes: > >> Signed-off-by: Mike Hommey >> --- > > As most lines in the affected function seems to come from your > fcb2c076 (commit-reach: implement get_reachable_subset, 2018-11-02), > I'll redirect the review of this patch to you. Stolee reviewed it already when the patch was sent the first time, here: https://lore.kernel.org/git/20230421234409.1925489-1-mh@glandium.org/T/#u > > Thanks. > >> commit-reach.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/commit-reach.c b/commit-reach.c >> index 70bde8af05..f15d84566b 100644 >> --- a/commit-reach.c >> +++ b/commit-reach.c >> @@ -944,6 +944,8 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, >> } >> } >> >> + clear_prio_queue(&queue); Makes sense: The loop that dequeues would end before consuming all items when all "to" commits are found to be reachable. >> + >> clear_commit_marks_many(nr_to, to, PARENT1); >> clear_commit_marks_many(nr_from, from, PARENT2);