git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: AZero13 via GitGitGadget <gitgitgadget@gmail.com>,
	 git@vger.kernel.org, Greg Funni <gfunni234@gmail.com>
Subject: Re: [PATCH] repository: cache->squash_msg is freed twice
Date: Fri, 19 Dec 2025 12:52:10 +0900	[thread overview]
Message-ID: <xmqq4ipnxh5h.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cRsKGERBk2pVotrKhhy5FCmmrQODTJEgkO8GuTY2SLbiA@mail.gmail.com> (Eric Sunshine's message of "Thu, 18 Dec 2025 13:18:32 -0500")

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Thu, Dec 18, 2025 at 10:26 AM AZero13 via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> Thankfully, it is set to NULL, so no security consequences.
>> However, this is still a mistake that must be rectified.
>>
>> Signed-off-by: Greg Funni <gfunni234@gmail.com>
>> ---
>> diff --git a/repository.c b/repository.c
>> @@ -349,7 +349,6 @@ out:
>>  static void repo_clear_path_cache(struct repo_path_cache *cache)
>>  {
>> -       FREE_AND_NULL(cache->squash_msg);
>>         FREE_AND_NULL(cache->squash_msg);
>>         FREE_AND_NULL(cache->merge_msg);
>>         FREE_AND_NULL(cache->merge_rr);
>
> This mistake has been present since Ævar added this function in
> 759f340738 (repository.c: free the "path cache" in repo_clear(),
> 2022-03-04), so it isn't the result of someone else coming along and
> adding a new field to the structure which needs freeing but then
> botching the call to FREE_AND_NULL(). Moreover, this function does
> free all the freeable members of repo_path_cache, hence, nothing is
> being leaked, so it must have just been a silly copy/paste mistake in
> the first place. Hence, this change makes sense.

Thanks, both.  Will queue.


      reply	other threads:[~2025-12-19  3:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 15:26 [PATCH] repository: cache->squash_msg is freed twice AZero13 via GitGitGadget
2025-12-18 15:49 ` [PATCH v2] repository: remove duplicate free of cache->squash_msg AZero13 via GitGitGadget
2025-12-18 18:18 ` [PATCH] repository: cache->squash_msg is freed twice Eric Sunshine
2025-12-19  3:52   ` 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=xmqq4ipnxh5h.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=gfunni234@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=sunshine@sunshineco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).