From: Ilia Alshanetsky Date: Wed, 17 Sep 2008 23:27:53 +0000 (+0000) Subject: Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on X-Git-Tag: BEFORE_NS_RULES_CHANGE~366 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4732ab390cd7bf07a3cdb0ddff97bfef79e20a15;p=php Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on multiple calls). --- 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 of 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