rrichards Tue Jun 10 18:24:54 2003 EDT
Modified files:
/php4/ext/dom text.c
Log:
Fixed memleaks
Index: php4/ext/dom/text.c
diff -u php4/ext/dom/text.c:1.5 php4/ext/dom/text.c:1.6
--- php4/ext/dom/text.c:1.5 Tue Jun 10 16:03:27 2003
+++ php4/ext/dom/text.c Tue Jun 10 18:24:54 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: text.c,v 1.5 2003/06/10 20:03:27 imajes Exp $ */
+/* $Id: text.c,v 1.6 2003/06/10 22:24:54 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -82,12 +82,16 @@
int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC)
{
xmlNodePtr node;
-
+ xmlChar *wholetext;
+
node = obj->ptr;
ALLOC_ZVAL(*retval);
- ZVAL_STRING(*retval, xmlNodeListGetString(node->doc, node, 1), 1);
-
+ wholetext = xmlNodeListGetString(node->doc, node, 1);
+ ZVAL_STRING(*retval, wholetext, 1);
+
+ xmlFree(wholetext);
+
return SUCCESS;
}
@@ -129,6 +133,7 @@
length = xmlStrlen(cur);
if (offset > length || offset < 0) {
+ xmlFree(cur);
RETURN_FALSE;
}
@@ -139,6 +144,9 @@
xmlNodeSetContentLen(node, first, offset);
nnode = xmlNewText(second);
+
+ xmlFree(first);
+ xmlFree(second);
nnode->type = XML_ELEMENT_NODE;
xmlAddNextSibling(node, nnode);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php