summaryrefslogtreecommitdiff
path: root/tools/llvm-dis/llvm-dis.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-16 22:37:52 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-16 22:37:52 +0000
commitc448aa66565252298028dec1a5fbc23ab6e24440 (patch)
tree0e265712d22b7b3d2d8be3a55a3328034f4acee5 /tools/llvm-dis/llvm-dis.cpp
parent460ee0fd19b13ba4c1410e43d8d253bf34673817 (diff)
llvm-dis: Fix memory leak. ParseBitcodeFile should be taking ownership of
the MemoryBuffer*, however, it doesn't seem to delete it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dis/llvm-dis.cpp')
-rw-r--r--tools/llvm-dis/llvm-dis.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 1d361885173..b4977ced5bd 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -80,12 +80,14 @@ int main(int argc, char **argv) {
std::string ErrorMessage;
std::auto_ptr<Module> M;
- OwningPtr<MemoryBuffer> BufferPtr;
- if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
- ErrorMessage = ec.message();
- else
- M.reset(ParseBitcodeFile(BufferPtr.take(), Context, &ErrorMessage));
+ {
+ OwningPtr<MemoryBuffer> BufferPtr;
+ if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
+ ErrorMessage = ec.message();
+ else
+ M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
+ }
if (M.get() == 0) {
errs() << argv[0] << ": ";