From: Alan Modra Date: Wed, 15 Apr 2020 07:10:54 +0000 (+0930) Subject: readelf: zero static vars after freeing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b71d4fa7c35c1918e96bc3c297f940b5c1624e21;p=binutils-gdb.git readelf: zero static vars after freeing When readelf is processing more than one file, static bss vars won't start out as zero for the second file unless they are cleared. * readelf.c (process_symbol_table): Zero gnubuckets, gnuchains etc. after freeing. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index e6c9c2ea8ae..a30d38d4aea 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2020-04-15 Alan Modra + + * readelf.c (process_symbol_table): Zero gnubuckets, gnuchains + etc. after freeing. + 2020-04-15 Alan Modra * readelf.c (get_group_flags): Translate text. diff --git a/binutils/readelf.c b/binutils/readelf.c index fb6f801b9fa..80af9a242ac 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -12260,16 +12260,24 @@ process_symbol_table (Filedata * filedata) free (lengths); } free (gnubuckets); + gnubuckets = NULL; free (gnuchains); + gnuchains = NULL; free (mipsxlat); + mipsxlat = NULL; return TRUE; err_out: free (gnubuckets); + gnubuckets = NULL; free (gnuchains); + gnuchains = NULL; free (mipsxlat); + mipsxlat = NULL; free (buckets); + buckets = NULL; free (chains); + chains = NULL; return FALSE; }