PR19553: Memory leak in RuntimeDyldELF::createObjectImageFromFile
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 29 Apr 2014 21:52:46 +0000 (21:52 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 29 Apr 2014 21:52:46 +0000 (21:52 +0000)
commit00121bb932ddbf026297f357c2d3cdf1414f628a
tree4a34633b0177e892b2b20a8753d10ffae4025eb0
parent2387e9ecb164b00f0802697bd667a59fb5295626
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: https://llvm.org/svn/llvm-project/llvm/trunk@207580 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ExecutionEngine/ExecutionEngine.h
include/llvm/ExecutionEngine/RuntimeDyld.h
lib/ExecutionEngine/MCJIT/MCJIT.cpp
lib/ExecutionEngine/MCJIT/MCJIT.h
lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
tools/lli/lli.cpp