summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2002-10-10 09:57:56 +0000
committerStanislav Malyshev <stas@php.net>2002-10-10 09:57:56 +0000
commit98ad93fb6d55bdf7212f26d851482bd6fa156873 (patch)
treebeb01c939d1a9da93e80ba3f56fdab62512a6c17
parent1b5ee53dd759966c3efd4e0786b1c8eee9a0204c (diff)
downloadphp-git-98ad93fb6d55bdf7212f26d851482bd6fa156873.tar.gz
fix memory leaks
-rw-r--r--Zend/zend_object_handlers.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index e514c718a1..a3877d72df 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -214,6 +214,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
/* if we are assigning reference, we shouldn't move it, but instead assign variable
to the same pointer */
if (PZVAL_IS_REF(*variable_ptr)) {
+ zval_dtor(*variable_ptr); /* old value should be destroyed */
(*variable_ptr)->type = value->type;
(*variable_ptr)->value = value->value;
zval_copy_ctor(*variable_ptr);
@@ -233,10 +234,9 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
if (!setter_done) {
/* if we assign referenced variable, we should separate it */
+ value->refcount++;
if (PZVAL_IS_REF(value)) {
SEPARATE_ZVAL(&value);
- } else {
- value->refcount++;
}
zend_hash_update(zobj->properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, &value, sizeof(zval *), NULL);
}