[llvm] r187697 - llvm-rtdyld: Don't leak memory managers.
Benjamin Kramer
benny.kra at googlemail.com
Sat Aug 3 15:16:31 PDT 2013
Author: d0k
Date: Sat Aug 3 17:16:31 2013
New Revision: 187697
URL: http://llvm.org/viewvc/llvm-project?rev=187697&view=rev
Log:
llvm-rtdyld: Don't leak memory managers.
Dyld never outlives MemMgr, just put both on the stack.
Modified:
llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=187697&r1=187696&r2=187697&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Sat Aug 3 17:16:31 2013
@@ -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())
More information about the llvm-commits
mailing list