summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2008-09-17 23:27:53 +0000
committerIlia Alshanetsky <iliaa@php.net>2008-09-17 23:27:53 +0000
commit4732ab390cd7bf07a3cdb0ddff97bfef79e20a15 (patch)
tree3520095f2c002258c56c3ff6ff35d24451f2c0bd
parente46d3289345662c7c6b416e671a6c5c0a08a5ba6 (diff)
downloadphp-git-4732ab390cd7bf07a3cdb0ddff97bfef79e20a15.tar.gz
Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on
multiple calls).
-rw-r--r--NEWS2
-rw-r--r--ext/xmlwriter/php_xmlwriter.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 4da6a65581..1b1d11de69 100644
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,8 @@ PHP NEWS
- Fixed a bug causing miscalculations with the "last <weekday> of <n> month"
relative time string. (Derick)
+- Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on
+ multiple calls). (Ilia)
- Fixed bug #46032 (PharData::__construct() wrong memory read). (Greg)
- Fixed bug #45826 (custom ArrayObject serialization). (Etienne)
- Fixed bug #45798 (sqlite3 doesn't notice if variable was bound). (Felipe)
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 309064eba5..58d7c60aff 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -1844,6 +1844,9 @@ static PHP_FUNCTION(xmlwriter_open_uri)
intern->uri_output = out_buffer;
#else
if (this) {
+ if (ze_obj->xmlwriter_ptr) {
+ xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr TSRMLS_CC);
+ }
ze_obj->xmlwriter_ptr = intern;
RETURN_TRUE;
} else
@@ -1894,6 +1897,9 @@ static PHP_FUNCTION(xmlwriter_open_memory)
intern->uri_output = NULL;
#else
if (this) {
+ if (ze_obj->xmlwriter_ptr) {
+ xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr TSRMLS_CC);
+ }
ze_obj->xmlwriter_ptr = intern;
RETURN_TRUE;
} else