diff --git a/globals.c b/globals.c index 94f78ddf..2bc3db27 100644 --- a/globals.c +++ b/globals.c @@ -50,20 +50,6 @@ void xmlInitGlobals(void) xmlThrDefMutex = xmlNewMutex(); } -/** - * xmlCleanupGlobals: - * - * Additional cleanup for multi-threading - */ -void xmlCleanupGlobals(void) -{ - if (xmlThrDefMutex != NULL) { - xmlFreeMutex(xmlThrDefMutex); - xmlThrDefMutex = NULL; - } - __xmlGlobalInitMutexDestroy(); -} - /************************************************************************ * * * All the user accessible global variables of the library * @@ -1122,3 +1108,19 @@ __xmlOutputBufferCreateFilenameValue(void) { return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue); } +/** + * xmlCleanupGlobals: + * + * Additional cleanup for multi-threading + */ +void xmlCleanupGlobals(void) +{ + xmlResetError(&xmlLastError); + + if (xmlThrDefMutex != NULL) { + xmlFreeMutex(xmlThrDefMutex); + xmlThrDefMutex = NULL; + } + __xmlGlobalInitMutexDestroy(); +} + diff --git a/parser.c b/parser.c index 54c5b0c2..3aecf3e9 100644 --- a/parser.c +++ b/parser.c @@ -14753,7 +14753,6 @@ xmlCleanupParser(void) { xmlSchemaCleanupTypes(); xmlRelaxNGCleanupTypes(); #endif - xmlResetLastError(); xmlCleanupGlobals(); xmlCleanupThreads(); /* must be last if called not from the main thread */ xmlCleanupMemory();