File tree 6 files changed +41
-4
lines changed
6 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -610,4 +610,12 @@ extern "C++" {
610
610
# define ZEND_PREFER_RELOAD
611
611
#endif
612
612
613
+ #if defined(ZEND_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
614
+ # define ZEND_IGNORE_LEAKS_BEGIN () _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) & ~_CRTDBG_ALLOC_MEM_DF)
615
+ # define ZEND_IGNORE_LEAKS_END () _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF)
616
+ #else
617
+ # define ZEND_IGNORE_LEAKS_BEGIN ()
618
+ # define ZEND_IGNORE_LEAKS_END ()
619
+ #endif
620
+
613
621
#endif /* ZEND_PORTABILITY_H */
Original file line number Diff line number Diff line change @@ -546,6 +546,7 @@ Bigint {
546
546
static Bigint * freelist [Kmax + 1 ];
547
547
548
548
static void destroy_freelist (void );
549
+ static void free_p5s (void );
549
550
550
551
#ifdef ZTS
551
552
static MUTEX_T dtoa_mutex ;
@@ -564,6 +565,8 @@ ZEND_API int zend_startup_strtod(void) /* {{{ */
564
565
ZEND_API int zend_shutdown_strtod (void ) /* {{{ */
565
566
{
566
567
destroy_freelist ();
568
+ free_p5s ();
569
+
567
570
#ifdef ZTS
568
571
tsrm_mutex_free (dtoa_mutex );
569
572
dtoa_mutex = NULL ;
@@ -4540,6 +4543,19 @@ static void destroy_freelist(void)
4540
4543
FREE_DTOA_LOCK (0 )
4541
4544
}
4542
4545
4546
+ static void free_p5s (void )
4547
+ {
4548
+ Bigint * * listp , * tmp ;
4549
+
4550
+ ACQUIRE_DTOA_LOCK (1 )
4551
+ listp = & p5s ;
4552
+ while ((tmp = * listp ) != NULL ) {
4553
+ * listp = tmp -> next ;
4554
+ free (tmp );
4555
+ }
4556
+ FREE_DTOA_LOCK (1 )
4557
+ }
4558
+
4543
4559
#ifdef __cplusplus
4544
4560
}
4545
4561
#endif
Original file line number Diff line number Diff line change @@ -59414,13 +59414,17 @@ void zend_vm_init(void)
59414
59414
VM_TRACE_START();
59415
59415
}
59416
59416
59417
+ static HashTable *zend_handlers_table = NULL;
59418
+
59417
59419
void zend_vm_dtor(void)
59418
59420
{
59419
59421
VM_TRACE_END();
59422
+ if (zend_handlers_table) {
59423
+ zend_hash_destroy(zend_handlers_table);
59424
+ free(zend_handlers_table);
59425
+ }
59420
59426
}
59421
59427
59422
- static HashTable *zend_handlers_table = NULL;
59423
-
59424
59428
static void init_opcode_serialiser(void)
59425
59429
{
59426
59430
int i;
Original file line number Diff line number Diff line change @@ -67,13 +67,17 @@ void {%INITIALIZER_NAME%}(void)
67
67
VM_TRACE_START();
68
68
}
69
69
70
+ static HashTable *zend_handlers_table = NULL;
71
+
70
72
void zend_vm_dtor(void)
71
73
{
72
74
VM_TRACE_END();
75
+ if (zend_handlers_table) {
76
+ zend_hash_destroy(zend_handlers_table);
77
+ free(zend_handlers_table);
78
+ }
73
79
}
74
80
75
- static HashTable *zend_handlers_table = NULL;
76
-
77
81
static void init_opcode_serialiser(void)
78
82
{
79
83
int i;
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ if (PHP_LIBXML == "yes") {
16
16
ADD_DEF_FILE ( "ext\\libxml\\php_libxml2.def" ) ;
17
17
}
18
18
PHP_INSTALL_HEADERS ( "ext/libxml/" , "php_libxml.h" ) ;
19
+ if ( PHP_CRT_DEBUG == "yes" ) {
20
+ ADD_FLAG ( "CFLAGS_LIBXML" , "/D PHP_WIN32_DEBUG_HEAP" ) ;
21
+ }
19
22
} else {
20
23
WARNING ( "libxml support can't be enabled, iconv or libxml are missing" )
21
24
PHP_LIBXML = "no"
Original file line number Diff line number Diff line change @@ -724,7 +724,9 @@ PHP_LIBXML_API void php_libxml_initialize(void)
724
724
{
725
725
if (!_php_libxml_initialized ) {
726
726
/* we should be the only one's to ever init!! */
727
+ ZEND_IGNORE_LEAKS_BEGIN ();
727
728
xmlInitParser ();
729
+ ZEND_IGNORE_LEAKS_END ();
728
730
729
731
_php_libxml_default_entity_loader = xmlGetExternalEntityLoader ();
730
732
xmlSetExternalEntityLoader (_php_libxml_pre_ext_ent_loader );
You can’t perform that action at this time.
0 commit comments