aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-11-20 14:39:32 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-21 08:23:40 +0900
commit96ab0e7b8b586322c1da6bbcd40773a54472679b (patch)
tree2625776d0a85b762b8c5733d23d90ced75e352c2
parent79366add74529359dfb57a387090e9c5f9c74282 (diff)
downloadgit-96ab0e7b8b586322c1da6bbcd40773a54472679b.tar.xz
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--bisect.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bisect.c b/bisect.c
index 9c52241050..e9e603877e 100644
--- a/bisect.c
+++ b/bisect.c
@@ -801,6 +801,8 @@ static enum bisect_error handle_bad_merge_base(void)
"between %s and [%s].\n"),
bad_hex, term_bad, term_good, bad_hex, good_hex);
}
+
+ free(good_hex);
return BISECT_MERGE_BASE_CHECK;
}