summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/Binary.cpp')
-rw-r--r--llvm/lib/Object/Binary.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Object/Binary.cpp b/llvm/lib/Object/Binary.cpp
index a0c412a64b2..a2f4ec9a0b8 100644
--- a/llvm/lib/Object/Binary.cpp
+++ b/llvm/lib/Object/Binary.cpp
@@ -26,12 +26,12 @@ using namespace llvm;
using namespace object;
Binary::~Binary() {
- delete Data;
+ if (BufferOwned)
+ delete Data;
}
-Binary::Binary(unsigned int Type, MemoryBuffer *Source)
- : TypeID(Type)
- , Data(Source) {}
+Binary::Binary(unsigned int Type, MemoryBuffer *Source, bool BufferOwned)
+ : TypeID(Type), BufferOwned(BufferOwned), Data(Source) {}
StringRef Binary::getData() const {
return Data->getBuffer();
OpenPOWER on IntegriCloud