summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2003-06-28 21:38:44 +0000
committerRob Richards <rrichards@php.net>2003-06-28 21:38:44 +0000
commita2259344502e8244ac5bbd4b46421d416ac82542 (patch)
tree0ed4b7777feb9caa2199cd67a77e0bf6749d33de
parent192fb9095e4d9e042535bbc0f14b759f72023c98 (diff)
downloadphp-git-a2259344502e8244ac5bbd4b46421d416ac82542.tar.gz
fix mem leak in sxe_property_read
fix compiler warning
-rw-r--r--ext/simplexml/simplexml.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 10f24f7aa0..35fc724c21 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -26,6 +26,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_simplexml.h"
+#include "zend_execute_locks.h"
zend_class_entry *sxe_class_entry;
@@ -105,8 +106,7 @@ sxe_property_read(zval *object, zval *member TSRMLS_DC)
xmlAttrPtr attr;
int counter = 0;
- ALLOC_ZVAL(return_value);
- return_value->refcount = 0;
+ MAKE_STD_ZVAL(return_value);
ZVAL_NULL(return_value);
name = Z_STRVAL_P(member);
@@ -146,7 +146,6 @@ sxe_property_read(zval *object, zval *member TSRMLS_DC)
if (match_ns(sxe, node, name)) {
MAKE_STD_ZVAL(value);
_node_as_zval(sxe, node->parent, value TSRMLS_CC);
- value->refcount = 0;
APPEND_CUR_ELEMENT(counter, value);
goto next_iter;
}
@@ -156,8 +155,6 @@ sxe_property_read(zval *object, zval *member TSRMLS_DC)
APPEND_PREV_ELEMENT(counter, value);
MAKE_STD_ZVAL(value);
_node_as_zval(sxe, node, value TSRMLS_CC);
- value->refcount = 0;
-
APPEND_CUR_ELEMENT(counter, value);
}
@@ -173,6 +170,9 @@ next_iter:
return_value = value;
}
+ /* create temporary variable */
+ PZVAL_UNLOCK(return_value);
+
return return_value;
}
/* }}} */
@@ -207,7 +207,7 @@ sxe_property_write(zval *object, zval *member, zval *value TSRMLS_DC)
php_sxe_object *sxe;
char *name;
xmlNodePtr node;
- xmlNodePtr newnode;
+ xmlNodePtr newnode = NULL;
xmlAttrPtr attr;
int counter = 0;
int is_attr = 0;