From 79366add74529359dfb57a387090e9c5f9c74282 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 20 Nov 2024 14:39:31 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- revision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 8df75b8224..347dabf7f9 100644 --- a/revision.c +++ b/revision.c @@ -51,8 +51,8 @@ volatile show_early_output_fn_t show_early_output; -static const char *term_bad; -static const char *term_good; +static char *term_bad; +static char *term_good; implement_shared_commit_slab(revision_sources, char *); -- cgit v1.2.3