[systemd-commits] src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jul 3 07:16:54 PDT 2012


 src/shared/hashmap.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 61b1477c8107e9b7143be9acf6bf678fa9d0674d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 3 16:15:57 2012 +0200

    hashmap: make hashmap_clear() work on NULL hashmaps

diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c
index ab00957..e2395d4 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);



More information about the systemd-commits mailing list