asan: readelf: memory leaks
authorAlan Modra <amodra@gmail.com>
Thu, 3 Dec 2020 05:40:37 +0000 (16:10 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 4 Dec 2020 00:42:21 +0000 (11:12 +1030)
commit288f0ba26478ec3a8926d54319b9c899e64e26a7
tree85c201688e41ebb65db77e9f3d579c90601f507b
parent726d7d1ecfd1fc0966983e1d5e59b527b90cf7c5
asan: readelf: memory leaks

This tidies some code used by readelf, hopefully fixing some
intermittent oss-fuzz bug reports that likely could only be reproduced
by feeding readelf two or more object files on the command line.  The
second and subsequent file may see non-zero state in .bss variables,
and non-initial values in .data variables.  This patch fixes some of
those, and moves some .data variables to .rodata.

* dwarf.c (frame_display_row): Do without static variable "sloc".
(cu_tu_indexes_read): Move to file scope.
(free_debug_memory): Reset it here, along with level_type_signed.
Free and clear a number of other static variables.
* readelf.c (arm_attr_public_tag <table>): Constify, updating..
(arm_attr_tag_*): ..all these uses.
(process_mips_specific): Free "rels" on error path.
binutils/ChangeLog
binutils/dwarf.c
binutils/readelf.c
This page took 0.024371 seconds and 4 git commands to generate.