llvm-rtdyld: Don't leak memory managers.

Dyld never outlives MemMgr, just put both on the stack.

llvm-svn: 187697
This commit is contained in:
Benjamin Kramer 2013-08-03 22:16:31 +00:00
parent 23632bd466
commit 9ce7708abb
1 changed files with 4 additions and 4 deletions

View File

@ -124,8 +124,8 @@ static int printLineInfoForInput() {
InputFileList.push_back("-");
for(unsigned i = 0, e = InputFileList.size(); i != e; ++i) {
// Instantiate a dynamic linker.
TrivialMemoryManager *MemMgr = new TrivialMemoryManager;
RuntimeDyld Dyld(MemMgr);
TrivialMemoryManager MemMgr;
RuntimeDyld Dyld(&MemMgr);
// Load the input memory buffer.
OwningPtr<MemoryBuffer> InputBuffer;
@ -180,8 +180,8 @@ static int printLineInfoForInput() {
static int executeInput() {
// Instantiate a dynamic linker.
TrivialMemoryManager *MemMgr = new TrivialMemoryManager;
RuntimeDyld Dyld(MemMgr);
TrivialMemoryManager MemMgr;
RuntimeDyld Dyld(&MemMgr);
// If we don't have any input files, read from stdin.
if (!InputFileList.size())