]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod/hash: check for NULL before freeing hash
authorDave Reisner <d@falconindy.com>
Thu, 5 Jan 2012 00:05:04 +0000 (19:05 -0500)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 5 Jan 2012 00:34:36 +0000 (22:34 -0200)
libkmod/libkmod-hash.c

index 8ca9cf41e2cb6729d97c7f19925b7ab8e88aad44..11dac669bfab0efbbf4e47af44eae5c36a5015dd 100644 (file)
@@ -64,6 +64,10 @@ struct hash *hash_new(unsigned int n_buckets,
 void hash_free(struct hash *hash)
 {
        struct hash_bucket *bucket, *bucket_end;
+
+       if (hash == NULL)
+               return;
+
        bucket = hash->buckets;
        bucket_end = bucket + hash->n_buckets;
        for (; bucket < bucket_end; bucket++) {