bisect: fix memory leak in `find_bisection()`
authorMartin Ågren <martin.agren@gmail.com>
Sun, 5 Nov 2017 20:24:29 +0000 (21:24 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Nov 2017 01:15:29 +0000 (10:15 +0900)
`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 <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c
index 5a3ae4971458b442ed43cd42834333c35d8421bb..2f4321767aec174ca57b4d89a4ae88926970bb67 100644 (file)
--- 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))