]> git.ipfire.org Git - thirdparty/git.git/commit
bisect: fix leaking good/bad terms when reading multipe times
authorPatrick Steinhardt <ps@pks.im>
Wed, 20 Nov 2024 13:39:31 +0000 (14:39 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Nov 2024 23:23:40 +0000 (08:23 +0900)
commit79366add74529359dfb57a387090e9c5f9c74282
tree97cdae18cc280b5397188a5b56eff7579e7b6b8b
parent65a1b7e2bdbdff523f8d55e0036bfad72467bfc8
bisect: fix leaking good/bad terms when reading multipe times

Even though `read_bisect_terms()` is declared as assigning string
constants, it in fact assigns allocated strings to the `read_bad` and
`read_good` out parameters. The only callers of this function assign the
result to global variables and thus don't have to free them in order to
be leak-free. But that changes when executing the function multiple
times because we'd then overwrite the previous value and thus make it
unreachable.

Fix the function signature and free the previous values. This leak is
exposed by t0630, 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
bisect.h
revision.c