From 61b1477c8107e9b7143be9acf6bf678fa9d0674d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 3 Jul 2012 16:15:57 +0200 Subject: hashmap: make hashmap_clear() work on NULL hashmaps --- src/shared/hashmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c index ab00957306..e2395d4d42 100644 --- a/src/shared/hashmap.c +++ b/src/shared/hashmap.c @@ -277,6 +277,9 @@ void hashmap_free(Hashmap*h) { } void hashmap_free_free(Hashmap *h) { + if (!h) + return; + hashmap_clear_free(h); hashmap_free(h); } @@ -292,7 +295,8 @@ void hashmap_clear(Hashmap *h) { void hashmap_clear_free(Hashmap *h) { void *p; - assert(h); + if (!h) + return; while ((p = hashmap_steal_first(h))) free(p); -- cgit v1.2.3-54-g00ecf