diff options
Diffstat (limited to 'bfd/elf32-crx.c')
-rw-r--r-- | bfd/elf32-crx.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c index cc6962f..a7406c0 100644 --- a/bfd/elf32-crx.c +++ b/bfd/elf32-crx.c @@ -742,6 +742,13 @@ elf32_crx_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); @@ -813,6 +820,8 @@ elf32_crx_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; } |