summaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index e5fb6454d34..0ecc6023e6d 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -460,22 +460,17 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
free_external = NULL;
}
- if (free_internal != NULL)
+ if (cache && free_internal != NULL)
{
- if (cache)
- free (free_internal);
- else
+ if (coff_section_data (abfd, sec) == NULL)
{
- if (coff_section_data (abfd, sec) == NULL)
- {
- amt = sizeof (struct coff_section_tdata);
- sec->used_by_bfd = bfd_zalloc (abfd, amt);
- if (sec->used_by_bfd == NULL)
- goto error_return;
- coff_section_data (abfd, sec)->contents = NULL;
- }
- coff_section_data (abfd, sec)->relocs = free_internal;
+ amt = sizeof (struct coff_section_tdata);
+ sec->used_by_bfd = bfd_zalloc (abfd, amt);
+ if (sec->used_by_bfd == NULL)
+ goto error_return;
+ coff_section_data (abfd, sec)->contents = NULL;
}
+ coff_section_data (abfd, sec)->relocs = free_internal;
}
return internal_relocs;