diff options
Diffstat (limited to 'bfd/elf32-cr16.c')
-rw-r--r-- | bfd/elf32-cr16.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 88d161e..555736c 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -1481,6 +1481,13 @@ elf32_cr16_get_relocated_section_contents (bfd *output_bfd, symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + bfd_byte *orig_data = data; + if (data == NULL) + { + data = bfd_malloc (input_section->size); + if (data == NULL) + return NULL; + } memcpy (data, elf_section_data (input_section)->this_hdr.contents, (size_t) input_section->size); @@ -1551,6 +1558,8 @@ elf32_cr16_get_relocated_section_contents (bfd *output_bfd, free (isymbuf); if (elf_section_data (input_section)->relocs != internal_relocs) free (internal_relocs); + if (orig_data == NULL) + free (data); return NULL; } |