Skip to content

Commit 8a34b33

Browse files
committed
Merge branch 'PHP-7.1'
2 parents 30be110 + 305f3c2 commit 8a34b33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend_alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,7 @@ static ZEND_COLD ZEND_NORETURN void zend_out_of_memory(void)
28182818
ZEND_API void * __zend_malloc(size_t len)
28192819
{
28202820
void *tmp = malloc(len);
2821-
if (EXPECTED(tmp)) {
2821+
if (EXPECTED(tmp || !len)) {
28222822
return tmp;
28232823
}
28242824
zend_out_of_memory();
@@ -2834,7 +2834,7 @@ ZEND_API void * __zend_calloc(size_t nmemb, size_t len)
28342834
ZEND_API void * __zend_realloc(void *p, size_t len)
28352835
{
28362836
p = realloc(p, len);
2837-
if (EXPECTED(p)) {
2837+
if (EXPECTED(p || !len)) {
28382838
return p;
28392839
}
28402840
zend_out_of_memory();

0 commit comments

Comments
 (0)