php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #62064
Patch xmlwriter_open_uri_leaks revision 2012-05-18 19:30 UTC by jean-pierre dot lozi at lip6 dot fr

Patch xmlwriter_open_uri_leaks for XML Writer Bug #62064

Patch version 2012-05-18 19:30 UTC

Return to Bug #62064 | Download this patch
Patch Revisions:

Developer: jean-pierre.lozi@lip6.fr

diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 84be01d..0514b17 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -614,6 +614,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
 		/* absolute file uris - libxml only supports localhost or empty host */
 		if (strncasecmp(source, "file:///", 8) == 0) {
 			if (source[sizeof("file:///") - 1] == '\0') {
+				xmlFreeURI(uri);
 				return NULL;
 			}
 			isFileUri = 1;
@@ -624,6 +625,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
 #endif
 		} else if (strncasecmp(source, "file://localhost/",17) == 0) {
 			if (source[sizeof("file://localhost/") - 1] == '\0') {
+				xmlFreeURI(uri);
 				return NULL;
 			}
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 17:01:27 2024 UTC