From: Rob Richards Date: Mon, 31 May 2004 11:20:46 +0000 (+0000) Subject: fix leak when using relaxng X-Git-Tag: php-5.0.0RC3RC2~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d82c42493125f7fbdaf0a9bae6051070db885b4;p=php fix leak when using relaxng interim fix for isolating our streams handling - once libxml supports overriding streams this should be changed for security reasons --- diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index a6e68a21df..cb0519631a 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -40,6 +40,9 @@ #include #include #include +#ifdef LIBXML_SCHEMAS_ENABLED +#include +#endif #include "php_libxml.h" @@ -241,7 +244,11 @@ static void php_libxml_init_globals(php_libxml_globals *libxml_globals_p TSRMLS_ int php_libxml_streams_IO_match_wrapper(const char *filename) { TSRMLS_FETCH(); - return php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC) ? 1 : 0; + + if (zend_is_executing(TSRMLS_C)) { + return php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC) ? 1 : 0; + } + return 0; } void *php_libxml_streams_IO_open_wrapper(const char *filename, const char *mode, const int read_only) @@ -408,6 +415,9 @@ PHP_LIBXML_API void php_libxml_initialize() { PHP_LIBXML_API void php_libxml_shutdown() { if (_php_libxml_initialized) { +#if defined(LIBXML_SCHEMAS_ENABLED) + xmlRelaxNGCleanupTypes(); +#endif xmlCleanupParser(); zend_hash_destroy(&php_libxml_exports); _php_libxml_initialized = 0;