summaryrefslogtreecommitdiff
path: root/Zend/zend_strtod.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-01-15 23:04:03 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-01-23 11:47:20 +0100
commit4130fe437a5db7ead1444d3748bd0fbad9829cb2 (patch)
tree02df4072419c04cab5695f0b9bf369041a286c2b /Zend/zend_strtod.c
parent984d508825cc5ae8eaad2e74bafa573d6706f6ff (diff)
downloadphp-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 'Zend/zend_strtod.c')
-rw-r--r--Zend/zend_strtod.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c
index 08f8424e8c..2228e2262c 100644
--- a/Zend/zend_strtod.c
+++ b/Zend/zend_strtod.c
@@ -546,6 +546,7 @@ Bigint {
static Bigint *freelist[Kmax+1];
static void destroy_freelist(void);
+static void free_p5s(void);
#ifdef ZTS
static MUTEX_T dtoa_mutex;
@@ -564,6 +565,8 @@ ZEND_API int zend_startup_strtod(void) /* {{{ */
ZEND_API int zend_shutdown_strtod(void) /* {{{ */
{
destroy_freelist();
+ free_p5s();
+
#ifdef ZTS
tsrm_mutex_free(dtoa_mutex);
dtoa_mutex = NULL;
@@ -4540,6 +4543,19 @@ static void destroy_freelist(void)
FREE_DTOA_LOCK(0)
}
+static void free_p5s(void)
+{
+ Bigint **listp, *tmp;
+
+ ACQUIRE_DTOA_LOCK(1)
+ listp = &p5s;
+ while ((tmp = *listp) != NULL) {
+ *listp = tmp->next;
+ free(tmp);
+ }
+ FREE_DTOA_LOCK(1)
+}
+
#ifdef __cplusplus
}
#endif