Skip to content

Commit 45cd9b3

Browse files
committed
changes from feedback
1 parent 313913f commit 45cd9b3

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Zend/zend_hash.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -853,13 +853,18 @@ static zend_always_inline void *zend_hash_next_index_insert_mem(HashTable *ht, v
853853
{
854854
zval tmp, *zv;
855855

856-
ZVAL_PTR(&tmp, NULL);
857-
if ((zv = zend_hash_next_index_insert(ht, &tmp))) {
858-
Z_PTR_P(zv) = pemalloc(size, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
859-
memcpy(Z_PTR_P(zv), pData, size);
860-
return Z_PTR_P(zv);
856+
void *p = pemalloc(size, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
857+
if (!p) {
858+
return NULL;
861859
}
862-
return NULL;
860+
861+
memcpy(p, pData, size);
862+
ZVAL_PTR(&tmp, p);
863+
if (!(zv = zend_hash_next_index_insert(ht, &tmp))) {
864+
pefree(p, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
865+
return NULL;
866+
}
867+
return Z_PTR_P(zv);
863868
}
864869

865870
static zend_always_inline void *zend_hash_find_ptr(const HashTable *ht, zend_string *key)

ext/standard/basic_functions.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,12 +1582,9 @@ static void fci_release(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache)
15821582
void user_shutdown_function_dtor(zval *zv) /* {{{ */
15831583
{
15841584
php_shutdown_function_entry *shutdown_function_entry = Z_PTR_P(zv);
1585-
zend_fcall_info *fci = &shutdown_function_entry->fci;
15861585

1587-
if (fci) {
1588-
zend_fcall_info_args_clear(fci, true);
1589-
fci_release(fci, &shutdown_function_entry->fci_cache);
1590-
}
1586+
zend_fcall_info_args_clear(&shutdown_function_entry->fci, true);
1587+
fci_release(&shutdown_function_entry->fci, &shutdown_function_entry->fci_cache);
15911588
efree(shutdown_function_entry);
15921589
}
15931590
/* }}} */

0 commit comments

Comments
 (0)