Fix a seg-fault in the AVR linker.
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Wed, 30 Mar 2016 13:52:26 +0000 (14:52 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 30 Mar 2016 13:52:26 +0000 (14:52 +0100)
* elf32-avr.c (avr_elf32_load_records_from_section): Free
internal_relocs only if they aren't cached.

bfd/ChangeLog
bfd/elf32-avr.c

index 7cf79bb14606e043410bdf054a0adad09915afb5..b1b053b43a431f8f3bcc170ffa80ca80b2d90550 100644 (file)
@@ -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
index 91994f04d6bbc407a806b068c45aa5b71663e645..764d0d1ffbc534dd063742bbeb9959805cf0c061 100644 (file)
@@ -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;