aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-04-15 16:40:54 +0930
committerAlan Modra <amodra@gmail.com>2020-04-15 17:03:22 +0930
commitb71d4fa7c35c1918e96bc3c297f940b5c1624e21 (patch)
tree9073e7e8708cd9c5fbd746be9c4e05edbe7c5037 /binutils
parent89246a0e7919e31f112526c11199ad2496980377 (diff)
downloadgdb-b71d4fa7c35c1918e96bc3c297f940b5c1624e21.zip
gdb-b71d4fa7c35c1918e96bc3c297f940b5c1624e21.tar.gz
gdb-b71d4fa7c35c1918e96bc3c297f940b5c1624e21.tar.bz2
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.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e6c9c2e..a30d38d 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,10 @@
2020-04-15 Alan Modra <amodra@gmail.com>
+ * readelf.c (process_symbol_table): Zero gnubuckets, gnuchains
+ etc. after freeing.
+
+2020-04-15 Alan Modra <amodra@gmail.com>
+
* readelf.c (get_group_flags): Translate text.
(get_file_type, get_symbol_binding, get_symbol_type),
(get_ppc64_symbol_other, get_symbol_other): Increase size of buffer.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index fb6f801..80af9a2 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;
}