diff options
author | Sean Callanan <scallanan@apple.com> | 2012-04-06 18:21:09 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2012-04-06 18:21:09 +0000 |
commit | e804b5b76283725b8f0bb0eb12a5ea0ab645b2c9 (patch) | |
tree | 752b3dc08c9399ea13b560a94b764d02749c68b8 /llvm/lib/MC/MCDisassembler/Disassembler.cpp | |
parent | 76cc43a2a471f921efc3db52d0a5134f75fe6190 (diff) | |
download | llvm-e804b5b76283725b8f0bb0eb12a5ea0ab645b2c9.zip llvm-e804b5b76283725b8f0bb0eb12a5ea0ab645b2c9.tar.gz llvm-e804b5b76283725b8f0bb0eb12a5ea0ab645b2c9.tar.bz2 |
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.
llvm-svn: 154192
Diffstat (limited to 'llvm/lib/MC/MCDisassembler/Disassembler.cpp')
-rw-r--r-- | llvm/lib/MC/MCDisassembler/Disassembler.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCDisassembler/Disassembler.cpp b/llvm/lib/MC/MCDisassembler/Disassembler.cpp index 27f5c31..35f675d 100644 --- a/llvm/lib/MC/MCDisassembler/Disassembler.cpp +++ b/llvm/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; |