diff options
author | Max Horn | 2010-11-04 00:49:12 +0000 |
---|---|---|
committer | Max Horn | 2010-11-04 00:49:12 +0000 |
commit | 99cf0e39368986086d5608509a52e1d4f1a70208 (patch) | |
tree | b318fd67ce82191fe0ffbb142210c53185859863 /backends | |
parent | 44c6a90643128af8c4521d5c5ee86d5885b79b0b (diff) | |
download | scummvm-rg350-99cf0e39368986086d5608509a52e1d4f1a70208.tar.gz scummvm-rg350-99cf0e39368986086d5608509a52e1d4f1a70208.tar.bz2 scummvm-rg350-99cf0e39368986086d5608509a52e1d4f1a70208.zip |
COMMON: Undo changes to common/ptr.h, remove Common::ScopedPtrC
The deletePointer() method approach cannot work, as it is called
by the destructor of the base class.
A possible correct solution would be to enhance ScopedPtr with a
"deleter" object like SharedPtr. But this seems overkill as long as we
need it in only one place.
svn-id: r54057
Diffstat (limited to 'backends')
-rw-r--r-- | backends/plugins/elf/elf-loader.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/backends/plugins/elf/elf-loader.cpp b/backends/plugins/elf/elf-loader.cpp index 17a67f4d02..24a4fda703 100644 --- a/backends/plugins/elf/elf-loader.cpp +++ b/backends/plugins/elf/elf-loader.cpp @@ -320,24 +320,30 @@ bool DLObject::load() { return false; } - Common::ScopedPtrC<Elf32_Shdr> shdr(loadSectionHeaders(&ehdr)); + Elf32_Shdr *shdr = loadSectionHeaders(&ehdr); if (!shdr) return false; _symtab_sect = loadSymbolTable(&ehdr, shdr); - if (_symtab_sect < 0) + if (_symtab_sect < 0) { + free(shdr); return false; + } - if (!loadStringTable(shdr)) + if (!loadStringTable(shdr)) { + free(shdr); return false; + } // Offset by our segment allocated address // must use _segmentVMA here for multiple segments (MIPS) _segmentOffset = ptrdiff_t(_segment) - _segmentVMA; relocateSymbols(_segmentOffset); - if (!relocateRels(&ehdr, shdr)) + if (!relocateRels(&ehdr, shdr)) { + free(shdr); return false; + } return true; } |