]> git.ipfire.org Git - thirdparty/git.git/commit
fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon
authorPaul Tarjan <github@paulisageek.com>
Thu, 9 Apr 2026 04:59:25 +0000 (04:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Apr 2026 17:59:27 +0000 (10:59 -0700)
commit20ea1e7e3e1cf4b15434b5f4e24249341c9e77be
treeb545e0c494c0be1058977516a7087e8c2b3adf19
parentc0901a7cd11b27e22a120f81a2bb4d44f3428a02
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