Skip to content

Commit 2b7706a

Browse files
pks-tgitster
authored andcommitted
bisect: fix leaking commit list items in check_merge_base()
While we free the result commit list at the end of `check_merge_base()`, we forget to free any items that we have already iterated over. Fix this by using a separate variable to iterate through them. This leak is exposed by t6030, but plugging it does not make the whole test suite pass. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cfb8a0d commit 2b7706a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bisect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
851851
rev + 1, &result) < 0)
852852
exit(128);
853853

854-
for (; result; result = result->next) {
855-
const struct object_id *mb = &result->item->object.oid;
854+
for (struct commit_list *l = result; l; l = l->next) {
855+
const struct object_id *mb = &l->item->object.oid;
856856
if (oideq(mb, current_bad_oid)) {
857857
res = handle_bad_merge_base();
858858
break;

0 commit comments

Comments
 (0)