aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-avr.c
diff options
context:
space:
mode:
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>2016-03-30 14:52:26 +0100
committerNick Clifton <nickc@redhat.com>2016-03-30 14:52:26 +0100
commit024ea11b48d2270cd0b3b2b6fbe9e42c9fd232e0 (patch)
treeaa76deb7f5723c3cd72b9fe52b4ff2b68d33652a /bfd/elf32-avr.c
parent7517e550ce646b9e4dddf8fe68de0eb308f53273 (diff)
downloadgdb-024ea11b48d2270cd0b3b2b6fbe9e42c9fd232e0.zip
gdb-024ea11b48d2270cd0b3b2b6fbe9e42c9fd232e0.tar.gz
gdb-024ea11b48d2270cd0b3b2b6fbe9e42c9fd232e0.tar.bz2
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.
Diffstat (limited to 'bfd/elf32-avr.c')
-rw-r--r--bfd/elf32-avr.c6
1 files changed, 4 insertions, 2 deletions
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;