[binutils-gdb] readelf: don't clear section_headers in process_file_header

Alan Modra amodra@sourceware.org
Sat Jun 12 02:42:16 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8c60e272c73b8021601f6e091879bc0fa1c5ab45

commit 8c60e272c73b8021601f6e091879bc0fa1c5ab45
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Jun 12 11:59:22 2021 +0930

    readelf: don't clear section_headers in process_file_header
    
            * readelf.c (process_file_header): Don't clear section_headers.

Diff:
---
 binutils/ChangeLog | 4 ++++
 binutils/readelf.c | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index fcf60568618..1297d275e80 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 4217ea3b5b0..79724e05494 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -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;


More information about the Binutils-cvs mailing list