llvm-rtdyld: Don't leak memory managers.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-08-03 22:16:31 +00:00
parent 527692a594
commit a757e93626

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())