summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c16
-rw-r--r--ext/opcache/zend_persist.c7
2 files changed, 11 insertions, 12 deletions
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 92350b7a0a..93999af11f 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -237,7 +237,6 @@ static void zend_destroy_property_info(zval *zv)
if (property_info->doc_comment) {
STR_RELEASE(property_info->doc_comment);
}
- efree(property_info);
}
static inline zend_string *zend_clone_str(zend_string *str TSRMLS_DC)
@@ -448,7 +447,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = ZEND_FUNCTION_DTOR;
- ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags = 0;
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
@@ -480,7 +479,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
q->key = zend_clone_str(p->key TSRMLS_CC);
/* Copy data */
- ZVAL_PTR(&q->val, (void *) emalloc(sizeof(zend_op_array)));
+ ZVAL_PTR(&q->val, (void *) zend_arena_alloc(&CG(arena), sizeof(zend_op_array)));
new_entry = (zend_op_array*)Z_PTR(q->val);
*new_entry = *(zend_op_array*)Z_PTR(p->val);
@@ -527,7 +526,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = zend_destroy_property_info;
- ht->u.flags = HASH_FLAG_APPLY_PROTECTION;
+ ht->u.flags = 0;
ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
@@ -559,7 +558,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
q->key = zend_clone_str(p->key TSRMLS_CC);
/* Copy data */
- ZVAL_PTR(&q->val, (void *) emalloc(sizeof(zend_property_info)));
+ ZVAL_PTR(&q->val, (void *) zend_arena_alloc(&CG(arena), sizeof(zend_property_info)));
prop_info = Z_PTR(q->val);
*prop_info = *(zend_property_info*)Z_PTR(p->val);
@@ -620,7 +619,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
zend_function *new_func;
TSRMLS_FETCH();
- *pce = ce = emalloc(sizeof(zend_class_entry));
+ *pce = ce = zend_arena_alloc(&CG(arena), sizeof(zend_class_entry));
*ce = *old_ce;
ce->refcount = 1;
@@ -667,6 +666,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
/* constants table */
zend_hash_clone_zval(&ce->constants_table, &old_ce->constants_table, 1);
+ ce->constants_table.u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
ce->name = zend_clone_str(ce->name TSRMLS_CC);
@@ -835,8 +835,8 @@ static void zend_accel_function_hash_copy(HashTable *target, HashTable *source,
}
}
if (pCopyConstructor) {
- Z_PTR_P(t) = emalloc(sizeof(zend_function));
- memcpy(Z_PTR_P(t), Z_PTR(p->val), sizeof(zend_function));
+ Z_PTR_P(t) = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(Z_PTR_P(t), Z_PTR(p->val), sizeof(zend_op_array));
pCopyConstructor(Z_PTR_P(t));
}
}
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index bc88df69cf..1f76f7ca03 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -552,7 +552,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
static void zend_persist_op_array(zval *zv TSRMLS_DC)
{
- zend_accel_store(Z_PTR_P(zv), sizeof(zend_op_array));
+ Z_PTR_P(zv) = zend_accel_memdup(Z_PTR_P(zv), sizeof(zend_op_array));
zend_persist_op_array_ex(Z_PTR_P(zv), NULL TSRMLS_CC);
}
@@ -560,8 +560,7 @@ static void zend_persist_property_info(zval *zv TSRMLS_DC)
{
zend_property_info *prop;
- zend_accel_store(Z_PTR_P(zv), sizeof(zend_property_info));
- prop = Z_PTR_P(zv);
+ prop = Z_PTR_P(zv) = zend_accel_memdup(Z_PTR_P(zv), sizeof(zend_property_info));
zend_accel_store_interned_string(prop->name);
if (prop->doc_comment) {
if (ZCG(accel_directives).save_comments) {
@@ -581,7 +580,7 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC)
zend_class_entry *ce = Z_PTR_P(zv);
if (ce->type == ZEND_USER_CLASS) {
- Z_PTR_P(zv) = zend_accel_store(ce, sizeof(zend_class_entry));
+ ce = Z_PTR_P(zv) = zend_accel_memdup(ce, sizeof(zend_class_entry));
zend_accel_store_interned_string(ce->name);
zend_hash_persist(&ce->function_table, zend_persist_op_array TSRMLS_CC);
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO