path: root/tools/lli
diff options
authorDavid Blaikie <>2014-04-29 21:52:46 +0000
committerDavid Blaikie <>2014-04-29 21:52:46 +0000
commit00121bb932ddbf026297f357c2d3cdf1414f628a (patch)
tree4a34633b0177e892b2b20a8753d10ffae4025eb0 /tools/lli
parent2387e9ecb164b00f0802697bd667a59fb5295626 (diff)
PR19553: Memory leak in RuntimeDyldELF::createObjectImageFromFile
This starts in MCJIT::getSymbolAddress where the unique_ptr<object::Binary> is release()d and (after a cast) passed to a single caller, MCJIT::addObjectFile. addObjectFile calls RuntimeDyld::loadObject. RuntimeDld::loadObject calls RuntimeDyldELF::createObjectFromFile And the pointer is never owned at this point. I say this point, because the alternative codepath, RuntimeDyldMachO::createObjectFile certainly does take ownership, so this seemed like a good hint that this was a/the right place to take ownership. git-svn-id: 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index f1413f302a3..4cde10579c8 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -534,7 +534,7 @@ int main(int argc, char **argv, char * const *envp) {
Err.print(argv[0], errs());
return 1;
- EE->addObjectFile(Obj.get());
+ EE->addObjectFile(std::unique_ptr<object::ObjectFile>(Obj.get()));
for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) {