public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel•com>
To: Junio C Hamano <gitster@pobox•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: Thu, 25 Sep 2025 10:17:54 -0700	[thread overview]
Message-ID: <de75e7f3-6c59-4f62-8d11-dea33804cc59@intel.com> (raw)
In-Reply-To: <xmqq5xd7jxpq.fsf@gitster.g>


[-- Attachment #1.1: Type: text/plain, Size: 1320 bytes --]



On 9/24/2025 3:24 PM, Junio C Hamano wrote:
> 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;

Please squash this in. I'll fix it if we need a v2 otherwise.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-09-25 17:18 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
2025-09-25 17:17     ` Jacob Keller [this message]
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=de75e7f3-6c59-4f62-8d11-dea33804cc59@intel.com \
    --to=jacob.e.keller@intel$(echo .)com \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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