public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Paul Tarjan <paul@paultarjan•com>
Cc: "Paul Tarjan via GitGitGadget" <gitgitgadget@gmail•com>,
	git@vger•kernel.org, "René Scharfe" <l.s.r@web•de>,
	"Paul Tarjan" <github@paulisageek•com>
Subject: Re: [PATCH v2] fsmonitor: fix khash memory leak in do_handle_client
Date: Sun, 04 Jan 2026 11:19:18 +0900	[thread overview]
Message-ID: <xmqq344mqfvd.fsf@gitster.g> (raw)
In-Reply-To: <CALvWuB6MW8g3Vd1-gKkZa_r86o0-t3gGazLSvsoBO4m6jjubeQ@mail.gmail.com> (Paul Tarjan's message of "Thu, 1 Jan 2026 15:24:27 -1000")

Paul Tarjan <paul@paultarjan•com> writes:

> On Thu, Jan 1, 2026 at 1:14 PM Junio C Hamano <gitster@pobox•com> wrote:
>>
>> "Paul Tarjan via GitGitGadget" <gitgitgadget@gmail•com> writes:
>>
>> > From: Paul Tarjan <github@paulisageek•com>
>> >
>> > The do_handle_client() function allocates a khash table to de-duplicate
>> > pathnames when responding to client requests. However, kh_release_str()
>> > was used instead of kh_destroy_str(). The release function only frees
>> > internal arrays (flags, keys, vals) but not the struct itself, which is
>> > allocated by kh_init_str() via xcalloc. This caused a 40-byte leak per
>> > client request.
>> >
>> > Fix by using kh_destroy_str() which properly frees both internal arrays
>> > and the struct itself. Also move the cleanup to the cleanup section and
>> > initialize shown to NULL so that kh_destroy_str() is safe to call on all
>> > exit paths.
>> >
>> > Signed-off-by: Paul Tarjan <github@paulisageek•com>
>> > ---
>>
>> This is already in v4 of the other larger fsmonitor-linux patch,
>> right?
>
> Correct. I sent it separately since it is currently a bug in existing
> code and you might want to merge it sooner.

Thanks.

      reply	other threads:[~2026-01-04  2:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 12:42 [PATCH] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2025-12-31  8:37 ` René Scharfe
2025-12-31 14:39 ` [PATCH v2] " Paul Tarjan via GitGitGadget
2026-01-01 23:14   ` Junio C Hamano
2026-01-02  1:24     ` Paul Tarjan
2026-01-04  2:19       ` 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=xmqq344mqfvd.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitgitgadget@gmail$(echo .)com \
    --cc=github@paulisageek$(echo .)com \
    --cc=l.s.r@web$(echo .)de \
    --cc=paul@paultarjan$(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