]> granicus.if.org Git - php/commitdiff
Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on
authorIlia Alshanetsky <iliaa@php.net>
Wed, 17 Sep 2008 23:27:53 +0000 (23:27 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 17 Sep 2008 23:27:53 +0000 (23:27 +0000)
multiple calls).

NEWS
ext/xmlwriter/php_xmlwriter.c

diff --git a/NEWS b/NEWS
index 4da6a655810913473cd1ee02baa6c3a9e8e44f93..1b1d11de696b92a137c20f596c3ab625f2ffb219 100644 (file)
--- 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)
index 309064eba540727aab95a42563a2e903d6e1e969..58d7c60affd3bcd40d570b12c276f82b094504f3 100644 (file)
@@ -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