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 | 7a1e775a7e6c3c7c7c283253dd8be39ff7c6da92 (patch) | |
tree | ada65930ad565a7029ec1c254e418b8f5c9d21ac /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h | |
parent | 836b1aed05c5d909fb399e8de9a299f4c5bed1d6 (diff) | |
download | bcm5719-llvm-7a1e775a7e6c3c7c7c283253dd8be39ff7c6da92.tar.gz bcm5719-llvm-7a1e775a7e6c3c7c7c283253dd8be39ff7c6da92.zip |
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.
llvm-svn: 207580
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h index 10061767534..85d6501a264 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h @@ -88,8 +88,8 @@ public: } static ObjectImage * - createObjectImageFromFile(object::ObjectFile *InputObject) { - return new ObjectImageCommon(InputObject); + createObjectImageFromFile(std::unique_ptr<object::ObjectFile> InputObject) { + return new ObjectImageCommon(std::move(InputObject)); } }; |