From: Marcus Boerger Date: Sat, 14 Jun 2003 11:32:30 +0000 (+0000) Subject: ecalloc doesn't return NULL X-Git-Tag: RELEASE_1_0_2~272 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4eb6392519c0cc9e419c15e670131ea8dd0f4854;p=php ecalloc doesn't return NULL --- diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index cfbc2049c6..08ca21ad31 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -146,14 +146,13 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunctio /* Uses ecalloc() so that Bucket* == NULL */ if (persistent) { ht->arBuckets = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *)); + if (!ht->arBuckets) { + return FAILURE; + } } else { ht->arBuckets = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *)); } - if (!ht->arBuckets) { - return FAILURE; - } - ht->pDestructor = pDestructor; ht->pListHead = NULL; ht->pListTail = NULL;