All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,  git@vger.kernel.org
Subject: Re: [PATCH] diff --no-index: fix logic for paths ending in '/'
Date: Wed, 24 Sep 2025 15:24:17 -0700	[thread overview]
Message-ID: <xmqq5xd7jxpq.fsf@gitster.g> (raw)
In-Reply-To: <xmqqa52jjxyq.fsf@gitster.g> (Junio C. Hamano's message of "Wed, 24 Sep 2025 15:18:53 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Hence, I think the clean-up code of this function this goto ...
>
>>  		goto out;
>
> ... jumps to would need
>
> 	strbuf_release(&ps_match1);
> 	strbuf_release(&ps_match2);
>
> added after that "out:" label?
>
> If we run this test with leak sanitizer, wouldn't it find leak in
> these (I haven't tried it myself---I just am speculating)?

Now I did, and my speculations were both correct.  The SANITIZE=leak
build fails, and with these two releases the test passes.

You can squash this in, or I can do so myself if you like, if this
is the only change that is required.

 diff-no-index.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git c/diff-no-index.c w/diff-no-index.c
index c70f82b805..f320424f05 100644
--- c/diff-no-index.c
+++ w/diff-no-index.c
@@ -436,6 +436,8 @@ int diff_no_index(struct rev_info *revs, const struct git_hash_algo *algop,
 	for (i = 0; i < ARRAY_SIZE(to_free); i++)
 		free(to_free[i]);
 	strbuf_release(&replacement);
+	strbuf_release(&ps_match1);
+	strbuf_release(&ps_match2);
 	if (ps)
 		clear_pathspec(ps);
 	return ret;

  reply	other threads:[~2025-09-24 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 20:57 [PATCH] diff --no-index: fix logic for paths ending in '/' Jacob Keller
2025-09-24 22:03 ` Junio C Hamano
2025-09-24 22:18 ` Junio C Hamano
2025-09-24 22:24   ` Junio C Hamano [this message]
2025-09-25 17:17     ` Jacob Keller
2025-09-25 18:36       ` Junio C Hamano
2025-10-10 16:13       ` Junio C Hamano
2025-10-13 23:14         ` Jacob Keller

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=xmqq5xd7jxpq.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.