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

Re: [PATCH v2] fsmonitor: fix khash memory leak in do_handle_client

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 1, 2026, 23:14 UTC
Message-ID
<xmqqbjjdc4d0.fsf@gitster.g>
In-Reply-To
<pull.2148.v2.git.git.1767191943962.gitgitgadget@gmail.com>
"Paul Tarjan via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 16 quoted lines
> 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.
Previous: Paul Tarjan via GitGitGadgetNext: Paul Tarjan
Message 4 of 6 in “fsmonitor: fix khash memory leak in do_handle_client”
  1. fsmonitor: fix khash memory leak in do_handle_clientPaul Tarjan via GitGitGadget, Dec 30, 2025
  2. René ScharfeDec 31, 2025
  3. fsmonitor: fix khash memory leak in do_handle_clientPaul Tarjan via GitGitGadget, Dec 31, 2025
  4. Junio C HamanoJan 1, 2026
  5. Paul TarjanJan 2, 2026
  6. Junio C HamanoJan 4, 2026

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.