From a05b4c9bedfe99815eb887903e7687fe2d1bb3f9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 13 Aug 2020 17:25:52 +0200 Subject: Make zix_hash_free() tolerate NULL --- zix/hash.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'zix') diff --git a/zix/hash.c b/zix/hash.c index e8acfea..c4a2dba 100644 --- a/zix/hash.c +++ b/zix/hash.c @@ -75,6 +75,10 @@ zix_hash_new(ZixHashFunc hash_func, ZIX_API void zix_hash_free(ZixHash* hash) { + if (!hash) { + return; + } + for (unsigned b = 0; b < *hash->n_buckets; ++b) { ZixHashEntry* bucket = hash->buckets[b]; for (ZixHashEntry* e = bucket; e;) { -- cgit v1.2.1