diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-07-03 16:15:57 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-07-03 16:15:57 +0200 |
commit | 61b1477c8107e9b7143be9acf6bf678fa9d0674d (patch) | |
tree | d6e109535ab439796dd809091b5cc6de5dda58d9 /src/shared | |
parent | 9946996cda11a18b44d82344676e5a0e96339408 (diff) |
hashmap: make hashmap_clear() work on NULL hashmaps
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/hashmap.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |