1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

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

llvm-svn: 312207
This commit is contained in:
Vitaly Buka 2017-08-31 02:38:58 +00:00
parent 1edfe9115e
commit 1897d0ce83

View File

@ -652,11 +652,13 @@ WindowsManifestMerger::WindowsManifestMergerImpl::getMergedManifest() {
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;