From 4732ab390cd7bf07a3cdb0ddff97bfef79e20a15 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 17 Sep 2008 23:27:53 +0000 Subject: [PATCH] Fixed bug #46110 (XMLWriter - openmemory() and openuri() leak memory on multiple calls). --- NEWS | 2 ++ ext/xmlwriter/php_xmlwriter.c | 6 ++++++ 2 files changed, 8 insertions(+) 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 -- 2.40.0