From da857a3d53ad7dc988ce48a2d57c69bd994b6bab Mon Sep 17 00:00:00 2001 From: LDA Date: Fri, 19 Jul 2024 16:08:25 +0200 Subject: [PATCH] [FIX] Pre-emptively free out the key I fail to see a reason why this shouldn't be done, to be fair, and it fixes a memory leakage with a Cytoplasm-based project I'm making. --- src/HashMap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/HashMap.c b/src/HashMap.c index 32a3199..eca0bdb 100644 --- a/src/HashMap.c +++ b/src/HashMap.c @@ -184,6 +184,8 @@ HashMapDelete(HashMap * map, const char *key) if (bucket->hash == hash) { bucket->hash = 0; + Free(bucket->key); + bucket->key = NULL; return bucket->value; }