Subject: Re: [PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Mar 2026 06:45:48 -0700

Jonas Rebmann <[email-masked]> writes:

>  #include "abspath.h"
> +#include "bisect.h"
>  #include "config.h"
>  #include "commit.h"
>  #include "environment.h"
> @@ -940,11 +941,14 @@ int cmd_rev_parse(int argc,
>  				continue;
>  			}
>  			if (!strcmp(arg, "--bisect")) {
> +				char *term_bad = NULL;
> +				char *term_good = NULL;
>  				struct refs_for_each_ref_options opts = { 0 };
> -				opts.prefix = "refs/bisect/bad";
> +				read_bisect_terms(&term_bad, &term_good);
> +				opts.prefix = xstrfmt("refs/bisect/%s", term_bad);
>  				refs_for_each_ref_ext(get_main_ref_store(the_repository),
>  						      show_reference, NULL, &opts);
> -				opts.prefix = "refs/bisect/good";
> +				opts.prefix = xstrfmt("refs/bisect/%s", term_good);
>  				refs_for_each_ref_ext(get_main_ref_store(the_repository),
>  						      anti_reference, NULL, &opts);

Aren't return values from two xstrfmt() calls leaking in this code?

>  				continue;