Index: lib/WindowsManifest/WindowsManifestMerger.cpp =================================================================== --- lib/WindowsManifest/WindowsManifestMerger.cpp +++ lib/WindowsManifest/WindowsManifestMerger.cpp @@ -652,11 +652,13 @@ xmlNodePtr CombinedRoot = xmlDocGetRootElement(CombinedDoc); std::vector RequiredPrefixes; checkAndStripPrefixes(CombinedRoot, RequiredPrefixes); - std::unique_ptr OutputDoc(xmlNewDoc((const unsigned char *)"1.0")); + std::unique_ptr OutputDoc( + xmlNewDoc((const unsigned char *)"1.0"), &xmlFreeDoc); xmlDocSetRootElement(OutputDoc.get(), CombinedRoot); xmlKeepBlanksDefault(0); xmlDocDumpFormatMemoryEnc(OutputDoc.get(), &XmlBuff, &BufferSize, "UTF-8", 1); + xmlDocSetRootElement(OutputDoc.get(), nullptr); } if (BufferSize == 0) return nullptr;