[PATCH] D37321: llvm-mt: Fix release of OutputDoc

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 19:40:20 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL312207: llvm-mt: Fix release of OutputDoc (authored by vitalybuka).

Repository:
  rL LLVM

https://reviews.llvm.org/D37321

Files:
  llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp


Index: llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp
===================================================================
--- llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp
+++ llvm/trunk/lib/WindowsManifest/WindowsManifestMerger.cpp
@@ -652,11 +652,13 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37321.113353.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170831/101a261e/attachment-0001.bin>


More information about the llvm-commits mailing list