[PATCH v2 2/4] bisect: fix memory leak in `find_bisection()`
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Nov 5, 2017, 20:24 UTC
- Message-ID
- <d682f573f68882c9dbb359d1abb3d7868d1cd77e.1509906092.git.martin.agren@gmail.com>
- In-Reply-To
- <cover.1509906092.git.martin.agren@gmail.com>
`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> --- bisect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bisect.c b/bisect.c index 5a3ae4971..2f4321767 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))
-- 2.15.0.415.gac1375d7e