]> git.ipfire.org Git - thirdparty/git.git/commit
fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon
authorPaul Tarjan <github@paulisageek.com>
Wed, 15 Apr 2026 13:27:27 +0000 (13:27 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Apr 2026 15:44:32 +0000 (08:44 -0700)
commit8b1d96554261aeef649bb3f36f9812a3c6e3f4da
treeb545e0c494c0be1058977516a7087e8c2b3adf19
parente21be6cd45db554862f40c90b385c1bc465c8335
fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon

The `state.cookies` hashmap is initialized during daemon startup but
never freed during cleanup in the `done:` label of
fsmonitor_run_daemon().  The cookie entries also have names allocated
via strbuf_detach() that must be freed individually.

Iterate the hashmap to free each cookie name, then call
hashmap_clear_and_free() to release the entries and table.

Signed-off-by: Paul Tarjan <github@paulisageek.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsmonitor--daemon.c