Skip to content

Commit 96ab0e7

Browse files
pks-tgitster
authored andcommitted
bisect: fix leaking string in handle_bad_merge_base()
When handling a bad merge base we print an error, which includes the set of good revisions joined by spaces. This string is allocated, but never freed. Fix this memory leak. Note that the local `bad_hex` varible also looks like a string that we should free. But in fact, `oid_to_hex()` returns an address to a static variable even though it is declared to return a non-constant string. The function signature is thus quite misleading and really should be fixed, but doing so is outside of the scope of this patch series. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 79366ad commit 96ab0e7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

bisect.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ static enum bisect_error handle_bad_merge_base(void)
801801
"between %s and [%s].\n"),
802802
bad_hex, term_bad, term_good, bad_hex, good_hex);
803803
}
804+
805+
free(good_hex);
804806
return BISECT_MERGE_BASE_CHECK;
805807
}
806808

0 commit comments

Comments
 (0)