[llvm] r312207 - llvm-mt: Fix release of OutputDoc
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 30 19:38:58 PDT 2017
Author: vitalybuka
Date: Wed Aug 30 19:38:58 2017
New Revision: 312207
URL: http://llvm.org/viewvc/llvm-project?rev=312207&view=rev
Log:
llvm-mt: Fix release of OutputDoc
Summary:
xmlDoc needs to be released with xmlFreeDoc.
Reset root element before release to avoid release of CombinedRoot owned
by CombinedDoc,
Reviewers: ecbeckmann, rnk, zturner, ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D37321
Modified:
llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp
Modified: llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp?rev=312207&r1=312206&r2=312207&view=diff
==============================================================================
--- llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp (original)
+++ llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp Wed Aug 30 19:38:58 2017
@@ -652,11 +652,13 @@ WindowsManifestMerger::WindowsManifestMe
xmlNodePtr CombinedRoot = xmlDocGetRootElement(CombinedDoc);
std::vector<xmlNsPtr> RequiredPrefixes;
checkAndStripPrefixes(CombinedRoot, RequiredPrefixes);
- std::unique_ptr<xmlDoc> OutputDoc(xmlNewDoc((const unsigned char *)"1.0"));
+ std::unique_ptr<xmlDoc, decltype(&xmlFreeDoc)> 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;
More information about the llvm-commits
mailing list