diff --git a/globals.c b/globals.c index 9f452448..1295a7ef 100644 --- a/globals.c +++ b/globals.c @@ -1007,6 +1007,13 @@ DllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason, } #endif break; + +#ifndef LIBXML_THREAD_ALLOC_ENABLED + case DLL_PROCESS_DETACH: + if (xmlFree == free) + xmlCleanupParser(); + break; +#endif } return TRUE; } diff --git a/threads.c b/threads.c index 2175f2c7..9b0e121a 100644 --- a/threads.c +++ b/threads.c @@ -385,13 +385,6 @@ static int onceControl = 0; static void xmlInitParserInternal(void) { -#if defined(_WIN32) && \ - !defined(LIBXML_THREAD_ALLOC_ENABLED) && \ - (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) - if (xmlFree == free) - atexit(xmlCleanupParser); -#endif - /* * Note that the initialization code must not make memory allocations. */