]> git.ipfire.org Git - thirdparty/git.git/commit
bisect: fix leaking `current_bad_oid`
authorPatrick Steinhardt <ps@pks.im>
Wed, 20 Nov 2024 13:39:33 +0000 (14:39 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Nov 2024 23:23:41 +0000 (08:23 +0900)
commita13d4a19d2b260e27b262292f07f5f315f04e07d
tree044ee4ed6e829bca558433be078f5c203118dfe5
parent96ab0e7b8b586322c1da6bbcd40773a54472679b
bisect: fix leaking `current_bad_oid`

When reading bisect refs we read the reference mapping to the "bad" term
into the global `current_bad_oid` variable. This is an allocated string,
but because it is global we never have to free it. This changes though
when `register_ref()` is being called multiple times, at which point
we'll overwrite the previous pointer and thus make it unreachable.

Fix this issue by freeing the previous value. This leak is exposed by
t6030, but plugging it does not make the whole test suite pass.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c