summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-hashtable.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c
index 0f4d91601..24476e402 100644
--- a/src/core/wee-hashtable.c
+++ b/src/core/wee-hashtable.c
@@ -514,6 +514,8 @@ hashtable_remove_item (struct t_hashtable *hashtable,
if (hashtable->htable[hash] == item)
hashtable->htable[hash] = item->next_item;
+ free (item);
+
hashtable->items_count--;
}
@@ -527,6 +529,9 @@ hashtable_remove (struct t_hashtable *hashtable, const void *key)
struct t_hashtable_item *ptr_item;
unsigned int hash;
+ if (!hashtable || !key)
+ return;
+
ptr_item = hashtable_get_item (hashtable, key, &hash);
if (ptr_item)
hashtable_remove_item (hashtable, ptr_item, hash);
@@ -560,6 +565,9 @@ hashtable_remove_all (struct t_hashtable *hashtable)
void
hashtable_free (struct t_hashtable *hashtable)
{
+ if (!hashtable)
+ return;
+
hashtable_remove_all (hashtable);
free (hashtable->htable);
free (hashtable);