mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-08 21:17:39 +03:00
Check for custom free function in global destructor
Calling a custom deallocation function in the global destructor could cause all kinds of unexpected problems. See for example https://github.com/sparklemotion/nokogiri/issues/2059 Only clean up if memory is managed with malloc/free.
This commit is contained in:
parent
8e7c20a1af
commit
956534e02e
7
parser.c
7
parser.c
@ -14696,7 +14696,12 @@ xmlCleanupParser(void) {
|
||||
static void
|
||||
ATTRIBUTE_DESTRUCTOR
|
||||
xmlDestructor(void) {
|
||||
xmlCleanupParser();
|
||||
/*
|
||||
* Calling custom deallocation functions in a destructor can cause
|
||||
* problems, for example with Nokogiri.
|
||||
*/
|
||||
if (xmlFree == free)
|
||||
xmlCleanupParser();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user