From 7a1e775a7e6c3c7c7c283253dd8be39ff7c6da92 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 29 Apr 2014 21:52:46 +0000 Subject: PR19553: Memory leak in RuntimeDyldELF::createObjectImageFromFile This starts in MCJIT::getSymbolAddress where the unique_ptr 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. llvm-svn: 207580 --- llvm/lib/ExecutionEngine/MCJIT/MCJIT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/ExecutionEngine/MCJIT/MCJIT.h') diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h index da1e975d4cd..100e9a23fcd 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h @@ -239,7 +239,7 @@ public: /// @name ExecutionEngine interface implementation /// @{ void addModule(Module *M) override; - void addObjectFile(object::ObjectFile *O) override; + void addObjectFile(std::unique_ptr O) override; void addArchive(object::Archive *O) override; bool removeModule(Module *M) override; -- cgit v1.2.3