libdwarf: Fix error handling in _dwarf_elf_init()

We were not setting "ret" before jumping to the error path, so the
function returned success even when it had failed.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33420
This commit is contained in:
Mark Johnston 2021-12-13 18:45:24 -05:00
parent fe04c91184
commit c983ec6428

View file

@ -398,17 +398,17 @@ _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error *error)
}
if ((sh.sh_flags & SHF_COMPRESSED) != 0) {
if (_dwarf_elf_decompress(dbg, e, scn, ed,
es, error) != DW_DLE_NONE)
if ((ret = _dwarf_elf_decompress(dbg, e, scn,
ed, es, error)) != DW_DLE_NONE)
goto fail_cleanup;
} else {
ed->ed_size = ed->ed_data->d_size;
}
if (_libdwarf.applyreloc) {
if (_dwarf_elf_relocate(dbg, elf,
if ((ret = _dwarf_elf_relocate(dbg, elf,
&e->eo_data[j], elf_ndxscn(scn), symtab_ndx,
symtab_data, error) != DW_DLE_NONE)
symtab_data, error)) != DW_DLE_NONE)
goto fail_cleanup;
}