diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-29 21:52:46 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-29 21:52:46 +0000 |
commit | 00121bb932ddbf026297f357c2d3cdf1414f628a (patch) | |
tree | 4a34633b0177e892b2b20a8753d10ffae4025eb0 /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h | |
parent | 2387e9ecb164b00f0802697bd667a59fb5295626 (diff) | |
download | llvm-00121bb932ddbf026297f357c2d3cdf1414f628a.tar.gz llvm-00121bb932ddbf026297f357c2d3cdf1414f628a.tar.bz2 llvm-00121bb932ddbf026297f357c2d3cdf1414f628a.tar.xz |
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
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h')
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h index 27db5cdf42..e08f2ee439 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h @@ -119,7 +119,7 @@ public: virtual ~RuntimeDyldELF(); static ObjectImage *createObjectImage(ObjectBuffer *InputBuffer); - static ObjectImage *createObjectImageFromFile(object::ObjectFile *Obj); + static ObjectImage *createObjectImageFromFile(std::unique_ptr<object::ObjectFile> Obj); }; } // end namespace llvm |