summaryrefslogtreecommitdiff
path: root/lib/MC/MCDisassembler/Disassembler.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-04-06 18:21:09 +0000
committerSean Callanan <scallanan@apple.com>2012-04-06 18:21:09 +0000
commit55e79804226f1da02ec880c120671ff930e3dbe4 (patch)
tree3fa559a95945b2de653bb1cc732b6abd9825a8b3 /lib/MC/MCDisassembler/Disassembler.cpp
parent70fbea7c7598c8803a325ffca98069ff013a2994 (diff)
downloadllvm-55e79804226f1da02ec880c120671ff930e3dbe4.tar.gz
llvm-55e79804226f1da02ec880c120671ff930e3dbe4.tar.bz2
llvm-55e79804226f1da02ec880c120671ff930e3dbe4.tar.xz
Fixed two leaks in the MC disassembler. The MC
disassembler requires a MCSubtargetInfo and a MCInstrInfo to exist in order to initialize the instruction printer and disassembler; however, although the printer and disassembler keep references to these objects they do not own them. Previously, the MCSubtargetInfo and MCInstrInfo objects were just leaked. I have extended LLVMDisasmContext to own these objects and delete them when it is destroyed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCDisassembler/Disassembler.cpp')
-rw-r--r--lib/MC/MCDisassembler/Disassembler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/MC/MCDisassembler/Disassembler.cpp b/lib/MC/MCDisassembler/Disassembler.cpp
index 27f5c31316..35f675dc6d 100644
--- a/lib/MC/MCDisassembler/Disassembler.cpp
+++ b/lib/MC/MCDisassembler/Disassembler.cpp
@@ -15,7 +15,9 @@
#include "llvm/MC/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
+#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/MemoryObject.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
@@ -89,7 +91,7 @@ LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,
LLVMDisasmContext *DC = new LLVMDisasmContext(TripleName, DisInfo, TagType,
GetOpInfo, SymbolLookUp,
TheTarget, MAI, MRI,
- Ctx, DisAsm, IP);
+ STI, MII, Ctx, DisAsm, IP);
assert(DC && "Allocation failure!");
return DC;