File tree 6 files changed +43
-4
lines changed
6 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -613,4 +613,12 @@ extern "C++" {
613
613
# define ZEND_PREFER_RELOAD
614
614
#endif
615
615
616
+ #if defined(ZEND_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
617
+ # define ZEND_IGNORE_LEAKS_BEGIN () _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) & ~_CRTDBG_ALLOC_MEM_DF)
618
+ # define ZEND_IGNORE_LEAKS_END () _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF)
619
+ #else
620
+ # define ZEND_IGNORE_LEAKS_BEGIN ()
621
+ # define ZEND_IGNORE_LEAKS_END ()
622
+ #endif
623
+
616
624
#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 @@ -59579,13 +59579,18 @@ void zend_vm_init(void)
59579
59579
VM_TRACE_START();
59580
59580
}
59581
59581
59582
+ static HashTable *zend_handlers_table = NULL;
59583
+
59582
59584
void zend_vm_dtor(void)
59583
59585
{
59584
59586
VM_TRACE_END();
59587
+ if (zend_handlers_table) {
59588
+ zend_hash_destroy(zend_handlers_table);
59589
+ free(zend_handlers_table);
59590
+ zend_handlers_table = NULL;
59591
+ }
59585
59592
}
59586
59593
59587
- static HashTable *zend_handlers_table = NULL;
59588
-
59589
59594
static void init_opcode_serialiser(void)
59590
59595
{
59591
59596
int i;
Original file line number Diff line number Diff line change @@ -67,13 +67,18 @@ 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
+ zend_handlers_table = NULL;
79
+ }
73
80
}
74
81
75
- static HashTable *zend_handlers_table = NULL;
76
-
77
82
static void init_opcode_serialiser(void)
78
83
{
79
84
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 @@ -700,7 +700,9 @@ PHP_LIBXML_API void php_libxml_initialize(void)
700
700
{
701
701
if (!_php_libxml_initialized ) {
702
702
/* we should be the only one's to ever init!! */
703
+ ZEND_IGNORE_LEAKS_BEGIN ();
703
704
xmlInitParser ();
705
+ ZEND_IGNORE_LEAKS_END ();
704
706
705
707
_php_libxml_default_entity_loader = xmlGetExternalEntityLoader ();
706
708
xmlSetExternalEntityLoader (_php_libxml_pre_ext_ent_loader );
You can’t perform that action at this time.
0 commit comments