[llvm] r347838 - Revert "[TextAPI] Fix a memory leak in the TBD reader."

Juergen Ributzka via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 28 22:32:49 PST 2018


Author: ributzka
Date: Wed Nov 28 22:32:49 2018
New Revision: 347838

URL: http://llvm.org/viewvc/llvm-project?rev=347838&view=rev
Log:
Revert "[TextAPI] Fix a memory leak in the TBD reader."

Modified:
    llvm/trunk/lib/TextAPI/MachO/TextStub.cpp

Modified: llvm/trunk/lib/TextAPI/MachO/TextStub.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TextAPI/MachO/TextStub.cpp?rev=347838&r1=347837&r2=347838&view=diff
==============================================================================
--- llvm/trunk/lib/TextAPI/MachO/TextStub.cpp (original)
+++ llvm/trunk/lib/TextAPI/MachO/TextStub.cpp Wed Nov 28 22:32:49 2018
@@ -634,13 +634,11 @@ TextAPIReader::get(std::unique_ptr<Memor
   std::vector<const InterfaceFile *> Files;
   YAMLIn >> Files;
 
-  auto File = std::unique_ptr<InterfaceFile>(
-      const_cast<InterfaceFile *>(Files.front()));
-
   if (YAMLIn.error())
     return make_error<StringError>(Ctx.ErrorMessage, YAMLIn.error());
 
-  return File;
+  auto *File = const_cast<InterfaceFile *>(Files.front());
+  return std::unique_ptr<InterfaceFile>(File);
 }
 
 Error TextAPIWriter::writeToStream(raw_ostream &OS, const InterfaceFile &File) {




More information about the llvm-commits mailing list