From 525aa8c4dc3e23f0369c7edb1fb507ecad5f43bf Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Wed, 23 Apr 2014 21:26:58 +0200 Subject: Fixed xerces DOM construction related memory leaks * Wrapped xerces DOM and support class instances in now DomDocumentGuard scope-guard class * FunctionReadDirectory class contains interal std::stack instance to store DomDocumentGuard instances ** wrapped in std::shared_ptr as FunctionReadDirectory is internally cloned by xalan... ** this is needed as the DOM has to preserved longer than the external function execution scope * Sadly XMLCh xerces strings have to be manually released ** added appropriate xercesc::XMLString::release calls * xalan::XercesDOMWrapperParsedSource does not mirror a given xerces DOM but convert it on instantiation ** this is why there is a dedicated finalize member method in InputXSLT::DomDocumentGuard * In short: I do not like the amount of trickery needed to simply prevent memory leaks in this context ** there sadly doesn't seem to be a substantially easier way to return arbitrary DOM trees from a external function --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 915a05d..94ade96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ add_executable( src/function/read_xml_file.cc src/function/read_directory.cc src/support/filesystem_context.cc + src/support/dom_document_guard.cc ) target_link_libraries( -- cgit v1.2.3