From 0cc6d8c9fbca6723cf8889df5784eedaaf4e69af Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 11 Dec 2024 13:14:29 +0800 Subject: [PATCH] Fix memory leak in the new hashtable unittest There is a leak in here, hashtableTwoPhasePopDelete won't call the entry destructor and like hashtablePop we need to call it by myself. Signed-off-by: Binbin --- src/unit/test_hashtable.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unit/test_hashtable.c b/src/unit/test_hashtable.c index 782fa0ee6a..689440e43d 100644 --- a/src/unit/test_hashtable.c +++ b/src/unit/test_hashtable.c @@ -303,6 +303,7 @@ int test_two_phase_insert_and_pop(int argc, char **argv, int flags) { TEST_ASSERT(hashtableSize(ht) == size_before_find); hashtableTwoPhasePopDelete(ht, &position); TEST_ASSERT(hashtableSize(ht) == size_before_find - 1); + free(e); } TEST_ASSERT(hashtableSize(ht) == 0);