From fc5c40bb2bb1921f3bdfa55c1d846dc080c356b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85gren?= Date: Sun, 5 Nov 2017 21:24:29 +0100 Subject: [PATCH] bisect: fix memory leak in `find_bisection()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `find_bisection()` rebuilds the commit list it is given by reversing it and skipping uninteresting commits. The uninteresting list entries are leaked. Free them to fix the leak. Signed-off-by: Martin Ă…gren Signed-off-by: Junio C Hamano --- bisect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bisect.c b/bisect.c index 5a3ae49714..2f4321767a 100644 --- a/bisect.c +++ b/bisect.c @@ -379,8 +379,10 @@ void find_bisection(struct commit_list **commit_list, int *reaches, unsigned flags = p->item->object.flags; next = p->next; - if (flags & UNINTERESTING) + if (flags & UNINTERESTING) { + free(p); continue; + } p->next = last; last = p; if (!(flags & TREESAME))