From 4f17bb0bd277b749e7e3c9946baf26ddde2916d7 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 4 Jan 2012 19:05:04 -0500 Subject: [PATCH] libkmod/hash: check for NULL before freeing hash --- libkmod/libkmod-hash.c | 4 ++++ 1 file changed, 4 insertions(+) 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++) { -- 2.47.2