From c2ee40ec2b3ea5e43946cbeb00583f8ffba626f5 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 6 Jul 2026 22:23:57 +0200 Subject: [PATCH] Fix leak on error in state_write --- cmdline/state.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmdline/state.c b/cmdline/state.c index 87d2f592..e50fa3e2 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -4117,10 +4117,17 @@ static void* state_write_thread(void* arg) if (context->first) bucket_to_list(&bucket_hash, &state->bucketlist, &state->bucketcount); + /* + * Do not need to free the bucket entries in the success path because they + * are added only if context->first is true, and they are already moved + * to the list. + */ + tommy_hashdyn_done(&bucket_hash); return 0; bail: + tommy_hashdyn_foreach(&bucket_hash, (tommy_foreach_func*)bucket_free); tommy_hashdyn_done(&bucket_hash); return context; }