cvs: ZendEngine2 / zend_object_handlers.c
| From: | Stanislav Malyshev | Date: | Thu, 10 Oct 2002 09:57:56 +0000 |
| Subject: | cvs: ZendEngine2 / zend_object_handlers.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-483@lists.php.net to get a copy of this message | ||
stas Thu Oct 10 05:57:56 2002 EDT
Modified files:
/ZendEngine2 zend_object_handlers.c
Log:
fix memory leaks
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.17 ZendEngine2/zend_object_handlers.c:1.18
--- ZendEngine2/zend_object_handlers.c:1.17 Wed Oct 9 13:14:25 2002
+++ ZendEngine2/zend_object_handlers.c Thu Oct 10 05:57:56 2002
@@ -214,6 +214,7 @@
/* 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 @@
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);
}