From: Alan Modra Date: Wed, 15 Apr 2020 07:10:54 +0000 (+0930) Subject: readelf: zero static vars after freeing X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=b71d4fa7c35c1918e96bc3c297f940b5c1624e21;p=deliverable%2Fbinutils-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 e6c9c2ea8a..a30d38d4ae 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 fb6f801b9f..80af9a242a 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; }