git: c983ec6428ec - main - libdwarf: Fix error handling in _dwarf_elf_init()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Dec 2021 23:50:43 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c983ec6428ecfa362903cbdba1dc9f4303e2f28c commit c983ec6428ecfa362903cbdba1dc9f4303e2f28c Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-12-13 23:45:24 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-12-13 23:46:59 +0000 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 --- contrib/elftoolchain/libdwarf/libdwarf_elf_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c b/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c index c9b6ae601e0e..68062ee3209f 100644 --- a/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c +++ b/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c @@ -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; }