* readelf: zero static vars after freeing
@ 2020-04-15 7:32 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-04-15 7:32 UTC (permalink / raw)
To: binutils
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/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;
}
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-15 7:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15 7:32 readelf: zero static vars after freeing Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).