From 00121bb932ddbf026297f357c2d3cdf1414f628a 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207580 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ExecutionEngine/RuntimeDyld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/llvm/ExecutionEngine/RuntimeDyld.h') diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h index 8d7b81bb6e..30c0d49ade 100644 --- a/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -55,7 +55,7 @@ public: /// Ownership of the input object is transferred to the ObjectImage /// instance returned from this function if successful. In the case of load /// failure, the input object will be deleted. - ObjectImage *loadObject(object::ObjectFile *InputObject); + ObjectImage *loadObject(std::unique_ptr InputObject); /// Get the address of our local copy of the symbol. This may or may not /// be the address used for relocation (clients can copy the data around -- cgit v1.2.3