asan: more readelf leaks
authorAlan Modra <amodra@gmail.com>
Fri, 13 Mar 2020 02:51:15 +0000 (13:21 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 13 Mar 2020 03:56:24 +0000 (14:26 +1030)
commitfd486f32d15e3299b905084a697fac6349c43f76
tree19dd88d1110f8a2e5ef2baa44a7e180a9d3e2467
parent49ba92c0a6765ee7dc3a773c1a044680d29cee0e
asan: more readelf leaks

* elfcomm.c (get_archive_member_name): Always return malloc'd
string or NULL.
* elfedit.c (process_archive): Tidy memory on all return paths.
* readelf.c (process_archive): Likewise.
(process_symbol_table): Likewise.
(ba_cache): New, replacing ..
(get_symbol_for_build_attribute): ..static vars here.  Free
strtab and symtab before loading new ones.  Reject symtab without
valid strtab in loop, breaking out of loop on valid symtab.
(process_file): Free ba_cache symtab and strtab here, resetting
ba_cache.
binutils/ChangeLog
binutils/elfcomm.c
binutils/elfedit.c
binutils/readelf.c