GNOME Bugzilla – Bug 698582
Error in xmlCleanupParser
Last modified: 2013-04-23 05:05:23 UTC
xmlCleanupParser function in parser.c /*...*/ xmlCleanupGlobals(); xmlResetLastError(); /*...*/ OS: Windows (but I think others too) problem appears then I load my library on libxml in one thread and unload it in another thread. xmlCleanupGlobals - cleans global variables. xmlResetLastError have such code: void xmlResetLastError(void) { if (xmlLastError.code == XML_ERR_OK) /* xmlLastError is macro!!! */ return; xmlResetError(&xmlLastError); } here it is: xmlError * __xmlLastError(void) { if (IS_MAIN_THREAD) return (&xmlLastError); else return (&xmlGetGlobalState()->xmlLastError); } in the function xmlGetGlobalState() we create global variables again, if they are not created. becouse of this I've got memory leak. You should change order of the functions in xmlCleanupParser: /*...*/ xmlResetLastError(); xmlCleanupGlobals(); /*...*/ Thank you for your work, and sorry for my english :-)
Okay, makes sense, even if xmlCleanupParser() is a very dangerous function, that's still a bug. Fixed in git: https://git.gnome.org/browse/libxml2/commit/?id=704d8c5e9ae911715d575abca03900591d56c040 thanks ! Daniel