diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-15 23:04:03 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-23 11:47:20 +0100 |
commit | 4130fe437a5db7ead1444d3748bd0fbad9829cb2 (patch) | |
tree | 02df4072419c04cab5695f0b9bf369041a286c2b /ext/libxml | |
parent | 984d508825cc5ae8eaad2e74bafa573d6706f6ff (diff) | |
download | php-git-4130fe437a5db7ead1444d3748bd0fbad9829cb2.tar.gz |
Make MSVCRT memory leak checking usable for the test suite
While basic support for MSVCRT debugging has been added long
ago[1], the leak checking is not usable for the test suite, because we
are no longer calling `xmlCleanupParser()` on RSHUTDOWN of
ext/libxml[2], and therefore a few bogus leaks are reported whenever
ext/libxml is unloaded.
We therefore ignore memory leaks for this case. We introduce
`ZEND_IGNORE_LEAKS_BEGIN()` and `ZEND_IGNORE_LEAKS_END()` to keep
those ignores better readable, and also because these *might* be
useful for other leak checkers as well.
We also explicitly free the `zend_handlers_table` and the `p5s` to
avoid spurious leak reports.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=d756e1db2324c1f4ab6f9b52e329959ce6a02bc3>
[2] <http://git.php.net/?p=php-src.git;a=commit;h=8742276eb3905eb97a585417000c7b8df85006d4>
Diffstat (limited to 'ext/libxml')
-rw-r--r-- | ext/libxml/config.w32 | 3 | ||||
-rw-r--r-- | ext/libxml/libxml.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/libxml/config.w32 b/ext/libxml/config.w32 index b11c57bc44..dd91c4b893 100644 --- a/ext/libxml/config.w32 +++ b/ext/libxml/config.w32 @@ -16,6 +16,9 @@ if (PHP_LIBXML == "yes") { ADD_DEF_FILE("ext\\libxml\\php_libxml2.def"); } PHP_INSTALL_HEADERS("ext/libxml/", "php_libxml.h"); + if (PHP_CRT_DEBUG == "yes") { + ADD_FLAG("CFLAGS_LIBXML", "/D PHP_WIN32_DEBUG_HEAP"); + } } else { WARNING("libxml support can't be enabled, iconv or libxml are missing") PHP_LIBXML = "no" diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 333dab4856..360d1999e7 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -752,7 +752,9 @@ PHP_LIBXML_API void php_libxml_initialize(void) { if (!_php_libxml_initialized) { /* we should be the only one's to ever init!! */ + ZEND_IGNORE_LEAKS_BEGIN(); xmlInitParser(); + ZEND_IGNORE_LEAKS_END(); _php_libxml_default_entity_loader = xmlGetExternalEntityLoader(); xmlSetExternalEntityLoader(_php_libxml_pre_ext_ent_loader); |