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.
This commit is contained in:
Senthil Kumar Selvaraj 2016-03-30 14:52:26 +01:00 committed by Nick Clifton
parent 7517e550ce
commit 024ea11b48
2 changed files with 9 additions and 2 deletions

View 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

View 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;