Skip to content

Commit 4eb6392

Browse files
committed
ecalloc doesn't return NULL
1 parent 4a97e3f commit 4eb6392

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Zend/zend_hash.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,13 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunctio
146146
/* Uses ecalloc() so that Bucket* == NULL */
147147
if (persistent) {
148148
ht->arBuckets = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *));
149+
if (!ht->arBuckets) {
150+
return FAILURE;
151+
}
149152
} else {
150153
ht->arBuckets = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *));
151154
}
152155

153-
if (!ht->arBuckets) {
154-
return FAILURE;
155-
}
156-
157156
ht->pDestructor = pDestructor;
158157
ht->pListHead = NULL;
159158
ht->pListTail = NULL;

0 commit comments

Comments
 (0)