[ELF] Dont release ownership of MemoryBuffer.

MemoryBuffer is being released too early. ELFFile owns MemoryBuffer.

llvm-svn: 228260
This commit is contained in:
Shankar Easwaran 2015-02-05 02:00:03 +00:00
parent c7f241cba9
commit 50ad727051
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ protected:
std::error_code doParse() override {
std::error_code ec;
_objFile.reset(
new llvm::object::ELFFile<ELFT>(_mb.release()->getBuffer(), ec));
new llvm::object::ELFFile<ELFT>(_mb->getBuffer(), ec));
if (ec)
return ec;

View File

@ -420,7 +420,7 @@ ELFFile<ELFT>::create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
template <class ELFT>
std::error_code ELFFile<ELFT>::doParse() {
std::error_code ec;
_objFile.reset(new llvm::object::ELFFile<ELFT>(_mb.release()->getBuffer(), ec));
_objFile.reset(new llvm::object::ELFFile<ELFT>(_mb->getBuffer(), ec));
if (ec)
return ec;