* xmlCleanupParser: * * This function name is somewhat misleading. It does not clean up * parser state, it cleans up memory allocated by the library itself. * It is a cleanup function for the XML library. It tries to reclaim all * related global memory allocated for the library processing. * It doesn't deallocate any document related memory. One should * call xmlCleanupParser() only when th
| 623 | * to avoid leak reports from valgrind ! |
| 624 | */ |
| 625 | void |
| 626 | xmlCleanupParser(void) { |
| 627 | if (!xmlParserInitialized) |
| 628 | return; |
| 629 | |
| 630 | /* These functions can call xmlFree. */ |
| 631 | |
| 632 | xmlCleanupCharEncodingHandlers(); |
| 633 | #ifdef LIBXML_CATALOG_ENABLED |
| 634 | xmlCatalogCleanup(); |
| 635 | #endif |
| 636 | #ifdef LIBXML_SCHEMAS_ENABLED |
| 637 | xmlSchemaCleanupTypes(); |
| 638 | xmlRelaxNGCleanupTypes(); |
| 639 | #endif |
| 640 | |
| 641 | /* These functions should never call xmlFree. */ |
| 642 | |
| 643 | xmlCleanupDictInternal(); |
| 644 | xmlCleanupRandom(); |
| 645 | xmlCleanupGlobalsInternal(); |
| 646 | /* |
| 647 | * Must come last. On Windows, xmlCleanupGlobalsInternal can call |
| 648 | * xmlFree which uses xmlMemMutex in debug mode. |
| 649 | */ |
| 650 | xmlCleanupMemoryInternal(); |
| 651 | |
| 652 | xmlGlobalInitMutexDestroy(); |
| 653 | |
| 654 | xmlParserInitialized = 0; |
| 655 | xmlParserInnerInitialized = 0; |
| 656 | } |
| 657 | |
| 658 | #if defined(HAVE_ATTRIBUTE_DESTRUCTOR) && \ |
| 659 | !defined(LIBXML_THREAD_ALLOC_ENABLED) && \ |