public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonas Rebmann <kernel@schlaraffenlan.de>
Cc: git@vger.kernel.org,  Chris Down <chris@chrisdown.name>,
	 Jeff King <peff@peff.net>
Subject: Re: [PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs
Date: Tue, 24 Mar 2026 06:45:48 -0700	[thread overview]
Message-ID: <87fr5pjq7n.fsf@gitster.g> (raw)
In-Reply-To: <20260323-bisect-terms-v2-2-8d6bdb2c9c7e@schlaraffenlan.de> (Jonas Rebmann's message of "Mon, 23 Mar 2026 23:49:00 +0100")

Jonas Rebmann <kernel@schlaraffenlan.de> 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;

      parent reply	other threads:[~2026-03-24 13:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 22:48 [PATCH v2 0/2] Avoid hardcoded "good"/"bad" bisect terms Jonas Rebmann
2026-03-23 22:48 ` [PATCH v2 1/2] bisect: use selected alternate terms in status output Jonas Rebmann
2026-03-24 10:43   ` Phillip Wood
2026-03-24 17:33     ` Junio C Hamano
2026-03-23 22:49 ` [PATCH v2 2/2] rev-parse: use selected alternate terms too look up refs Jonas Rebmann
2026-03-24 10:49   ` Phillip Wood
2026-03-24 12:30     ` Jonas Rebmann
2026-03-24 14:11       ` Phillip Wood
2026-03-24 13:45   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fr5pjq7n.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chris@chrisdown.name \
    --cc=git@vger.kernel.org \
    --cc=kernel@schlaraffenlan.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox