summaryrefslogtreecommitdiff
path: root/lib/Object/Archive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/Archive.cpp')
-rw-r--r--lib/Object/Archive.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index 05e891384f..cd8924920a 100644
--- a/lib/Object/Archive.cpp
+++ b/lib/Object/Archive.cpp
@@ -181,7 +181,12 @@ Archive::Child::getAsBinary(LLVMContext *Context) const {
ErrorOr<std::unique_ptr<MemoryBuffer>> BuffOrErr = getMemoryBuffer();
if (std::error_code EC = BuffOrErr.getError())
return EC;
- return createBinary(BuffOrErr.get().release(), Context);
+
+ std::unique_ptr<MemoryBuffer> Buff(BuffOrErr.get().release());
+ ErrorOr<std::unique_ptr<Binary>> Ret = createBinary(Buff.get(), Context);
+ if (!Ret.getError())
+ Buff.release();
+ return Ret;
}
ErrorOr<Archive*> Archive::create(MemoryBuffer *Source) {