readelf: zero static vars after freeing
authorAlan Modra <amodra@gmail.com>
Wed, 15 Apr 2020 07:10:54 +0000 (16:40 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 15 Apr 2020 07:33:22 +0000 (17:03 +0930)
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.

binutils/ChangeLog
binutils/readelf.c

index e6c9c2ea8ae951bbc163fa23cc47f338f3172919..a30d38d4aea0973ff69d4957a836356bd57d4024 100644 (file)
@@ -1,3 +1,8 @@
+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.
index fb6f801b9fab53b3f1008abc60aff23d876a1fd6..80af9a242acd03c8137a1256f6102c512c75b64e 100644 (file)
@@ -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;
 }
 
This page took 0.030241 seconds and 4 git commands to generate.