File tree Expand file tree Collapse file tree 6 files changed +41
-4
lines changed Expand file tree Collapse file tree 6 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -610,4 +610,12 @@ extern "C++" {
610610# define ZEND_PREFER_RELOAD
611611#endif
612612
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+
613621#endif /* ZEND_PORTABILITY_H */
Original file line number Diff line number Diff line change @@ -546,6 +546,7 @@ Bigint {
546546 static Bigint * freelist [Kmax + 1 ];
547547
548548static void destroy_freelist (void );
549+ static void free_p5s (void );
549550
550551#ifdef ZTS
551552static MUTEX_T dtoa_mutex ;
@@ -564,6 +565,8 @@ ZEND_API int zend_startup_strtod(void) /* {{{ */
564565ZEND_API int zend_shutdown_strtod (void ) /* {{{ */
565566{
566567 destroy_freelist ();
568+ free_p5s ();
569+
567570#ifdef ZTS
568571 tsrm_mutex_free (dtoa_mutex );
569572 dtoa_mutex = NULL ;
@@ -4540,6 +4543,19 @@ static void destroy_freelist(void)
45404543 FREE_DTOA_LOCK (0 )
45414544}
45424545
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+
45434559#ifdef __cplusplus
45444560}
45454561#endif
Original file line number Diff line number Diff line change @@ -59414,13 +59414,17 @@ void zend_vm_init(void)
5941459414 VM_TRACE_START();
5941559415}
5941659416
59417+ static HashTable *zend_handlers_table = NULL;
59418+
5941759419void zend_vm_dtor(void)
5941859420{
5941959421 VM_TRACE_END();
59422+ if (zend_handlers_table) {
59423+ zend_hash_destroy(zend_handlers_table);
59424+ free(zend_handlers_table);
59425+ }
5942059426}
5942159427
59422- static HashTable *zend_handlers_table = NULL;
59423-
5942459428static void init_opcode_serialiser(void)
5942559429{
5942659430 int i;
Original file line number Diff line number Diff line change @@ -67,13 +67,17 @@ void {%INITIALIZER_NAME%}(void)
6767 VM_TRACE_START();
6868}
6969
70+ static HashTable *zend_handlers_table = NULL;
71+
7072void zend_vm_dtor(void)
7173{
7274 VM_TRACE_END();
75+ if (zend_handlers_table) {
76+ zend_hash_destroy(zend_handlers_table);
77+ free(zend_handlers_table);
78+ }
7379}
7480
75- static HashTable *zend_handlers_table = NULL;
76-
7781static void init_opcode_serialiser(void)
7882{
7983 int i;
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ if (PHP_LIBXML == "yes") {
1616 ADD_DEF_FILE ( "ext\\libxml\\php_libxml2.def" ) ;
1717 }
1818 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+ }
1922 } else {
2023 WARNING ( "libxml support can't be enabled, iconv or libxml are missing" )
2124 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)
724724{
725725 if (!_php_libxml_initialized ) {
726726 /* we should be the only one's to ever init!! */
727+ ZEND_IGNORE_LEAKS_BEGIN ();
727728 xmlInitParser ();
729+ ZEND_IGNORE_LEAKS_END ();
728730
729731 _php_libxml_default_entity_loader = xmlGetExternalEntityLoader ();
730732 xmlSetExternalEntityLoader (_php_libxml_pre_ext_ent_loader );
You can’t perform that action at this time.
0 commit comments