From: Junio C Hamano <gitster@pobox•com>
To: "Paul Tarjan via GitGitGadget" <gitgitgadget@gmail•com>
Cc: 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: Fri, 02 Jan 2026 08:14:51 +0900 [thread overview]
Message-ID: <xmqqbjjdc4d0.fsf@gitster.g> (raw)
In-Reply-To: <pull.2148.v2.git.git.1767191943962.gitgitgadget@gmail.com> (Paul Tarjan via GitGitGadget's message of "Wed, 31 Dec 2025 14:39:03 +0000")
"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?
Thanks.
next prev parent reply other threads:[~2026-01-01 23:14 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 [this message]
2026-01-02 1:24 ` Paul Tarjan
2026-01-04 2:19 ` Junio C Hamano
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=xmqqbjjdc4d0.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 \
/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