aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-nds32.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-nds32.c')
-rw-r--r--bfd/elf32-nds32.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 35e0302..5d22002 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -13100,6 +13100,7 @@ nds32_elf_get_relocated_section_contents (bfd *abfd,
return NULL;
/* Read in the section. */
+ bfd_byte *orig_data = data;
if (!nds32_get_section_contents (input_bfd, input_section, &data, false))
return NULL;
@@ -13108,7 +13109,7 @@ nds32_elf_get_relocated_section_contents (bfd *abfd,
reloc_vector = (arelent **) bfd_malloc (reloc_size);
if (reloc_vector == NULL)
- return NULL;
+ goto error_return;
reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
reloc_vector, symbols);
@@ -13202,6 +13203,8 @@ nds32_elf_get_relocated_section_contents (bfd *abfd,
error_return:
free (reloc_vector);
+ if (orig_data == NULL)
+ free (data);
return NULL;
}