readelf: don't clear section_headers in process_file_header
authorAlan Modra <amodra@gmail.com>
Sat, 12 Jun 2021 02:29:22 +0000 (11:59 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 12 Jun 2021 02:31:26 +0000 (12:01 +0930)
* readelf.c (process_file_header): Don't clear section_headers.

binutils/ChangeLog
binutils/readelf.c

index fcf6056861802ae1234a40688ce08f14c00c9a08..1297d275e8042a920c5c1d6ce9016d513b976d55 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-12  Alan Modra  <amodra@gmail.com>
+
+       * readelf.c (process_file_header): Don't clear section_headers.
+
 2021-06-12  Alan Modra  <amodra@gmail.com>
 
        * readelf.c (get_section_headers): Don't test e_shoff here, leave
index 4217ea3b5b03a1f23deef3b844ae14d4c69e6194..79724e0549467c28d3af0511554cce11adcff489 100644 (file)
@@ -5237,8 +5237,6 @@ process_file_header (Filedata * filedata)
        header->e_shstrndx = filedata->section_headers[0].sh_link;
       if (header->e_shstrndx >= header->e_shnum)
        header->e_shstrndx = SHN_UNDEF;
-      free (filedata->section_headers);
-      filedata->section_headers = NULL;
     }
 
   return true;