git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff --no-index: fix logic for paths ending in '/'

From
Jacob Keller <jacob.e.keller@intel.com>
Date
Sep 25, 2025, 17:17 UTC
Message-ID
<de75e7f3-6c59-4f62-8d11-dea33804cc59@intel.com>
In-Reply-To
<xmqq5xd7jxpq.fsf@gitster.g>
On 9/24/2025 3:24 PM, Junio C Hamano wrote:
Show 38 quoted lines
> 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.
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 8 in “diff --no-index: fix logic for paths ending in '/'”
  1. diff --no-index: fix logic for paths ending in '/'Jacob Keller, Sep 24, 2025
  2. Junio C HamanoSep 24, 2025
  3. Junio C HamanoSep 24, 2025
  4. Junio C HamanoSep 24, 2025
  5. Jacob KellerSep 25, 2025
  6. Junio C HamanoSep 25, 2025
  7. Junio C HamanoOct 10, 2025
  8. Jacob KellerOct 13, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.