From d481c0e564c101e147a44e30e5bd1bb997310566 Mon Sep 17 00:00:00 2001 From: Binbin Date: Fri, 8 Dec 2023 15:51:14 +0800 Subject: [PATCH] Explicit judgment even if zfree can handle null pointers --- src/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dict.c b/src/dict.c index 36a3a8b29b9..79ab7f6845f 100644 --- a/src/dict.c +++ b/src/dict.c @@ -270,7 +270,7 @@ int _dictExpand(dict *d, unsigned long size, int* malloc_failed) * it can accept keys. */ if (d->ht_table[0] == NULL || d->ht_used[0] == 0) { if (d->type->rehashingCompleted) d->type->rehashingCompleted(d); - if (d->ht_used[0] == 0) zfree(d->ht_table[0]); + if (d->ht_table[0] && d->ht_used[0] == 0) zfree(d->ht_table[0]); d->ht_size_exp[0] = new_ht_size_exp; d->ht_used[0] = new_ht_used; d->ht_table[0] = new_ht_table;