This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix a seg-fault in the AVR linker.


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

commit 024ea11b48d2270cd0b3b2b6fbe9e42c9fd232e0
Author: Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Date:   Wed Mar 30 14:52:26 2016 +0100

    Fix a seg-fault in the AVR linker.
    
    	* elf32-avr.c (avr_elf32_load_records_from_section): Free
    	internal_relocs only if they aren't cached.

Diff:
---
 bfd/ChangeLog   | 5 +++++
 bfd/elf32-avr.c | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7cf79bb..b1b053b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-30  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+	* elf32-avr.c (avr_elf32_load_records_from_section): Free
+	internal_relocs only if they aren't cached.
+
 2016-03-29  Nick Clifton  <nickc@redhat.com>
 
 	PR 17334
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 91994f0..764d0d1 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -4068,11 +4068,13 @@ avr_elf32_load_records_from_section (bfd *abfd, asection *sec)
     }
 
   free (contents);
-  free (internal_relocs);
+  if (elf_section_data (sec)->relocs != internal_relocs)
+    free (internal_relocs);
   return r_list;
 
  load_failed:
-  free (internal_relocs);
+  if (elf_section_data (sec)->relocs != internal_relocs)
+    free (internal_relocs);
   free (contents);
   free (r_list);
   return NULL;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]