Hi, In function zend_hash_init() when allocate no persistent memory (if flag persistent is 0) for arBuckets element of struct HashTable and virtual memory is over, the function always returns SUCCESS
Code: if (persistent) { tmp = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *)); if (!tmp) { return FAILURE; } ht->arBuckets = tmp; } else { // No checking on return value? tmp = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *)); if (tmp) { ht->arBuckets = tmp; } }
diff -Nur php-src-5.3.orig//Zend/zend_hash.c php-src-5.3/Zend/zend_hash.c --- php-src-5.3.orig//Zend/zend_hash.c 2011-04-28 17:14:31.003354396 +0700 +++ php-src-5.3/Zend/zend_hash.c 2011-04-28 17:15:42.081164359 +0700 @@ -175,9 +175,10 @@ ht->arBuckets = tmp; } else { tmp = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *)); - if (tmp) { - ht->arBuckets = tmp; + if (!tmp) { + return FAILURE; } + ht->arBuckets = tmp; } return SUCCESS;
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php