From: Dave Reisner Date: Thu, 5 Jan 2012 00:05:04 +0000 (-0500) Subject: libkmod/hash: check for NULL before freeing hash X-Git-Tag: v3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f17bb0bd277b749e7e3c9946baf26ddde2916d7;p=thirdparty%2Fkmod.git libkmod/hash: check for NULL before freeing hash --- diff --git a/libkmod/libkmod-hash.c b/libkmod/libkmod-hash.c index 8ca9cf41..11dac669 100644 --- a/libkmod/libkmod-hash.c +++ b/libkmod/libkmod-hash.c @@ -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++) {