Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
bisect: fix memory leak when returning best element
author
Martin Ågren
<martin.agren@gmail.com>
Sun, 5 Nov 2017 20:24:31 +0000
(21:24 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 6 Nov 2017 01:15:29 +0000
(10:15 +0900)
When `find_bisection()` returns a single list entry, it leaks the other
entries. Move the to-be-returned item to the front and free the
remainder.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
7c11718
)
diff --git
a/bisect.c
b/bisect.c
index b1941505b236b5cb56ea7fe757dab215dcf2bb07..3756f127b0fbaee3959011dbcd2beebbf067c5af 100644
(file)
--- a/
bisect.c
+++ b/
bisect.c
@@
-399,8
+399,12
@@
void find_bisection(struct commit_list **commit_list, int *reaches,
/* Do the real work of finding bisection commit. */
best = do_find_bisection(list, nr, weights, find_all);
if (best) {
- if (!find_all)
+ if (!find_all) {
+ list->item = best->item;
+ free_commit_list(list->next);
+ best = list;
best->next = NULL;
+ }
*reaches = weight(best);
}
free(weights);