aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-07-27 22:35:08 +0000
committerNick Clifton <nickc@redhat.com>2000-07-27 22:35:08 +0000
commit755cfd29220e9f80de4dac75f4c95e73e9927b30 (patch)
treedbd2b1baf945c534ddb63f28b7510321fafa6c85 /bfd/elflink.h
parent3929b9d28a31c4c4a57dc8788ada06ea4a1a4cc2 (diff)
downloadgdb-755cfd29220e9f80de4dac75f4c95e73e9927b30.zip
gdb-755cfd29220e9f80de4dac75f4c95e73e9927b30.tar.gz
gdb-755cfd29220e9f80de4dac75f4c95e73e9927b30.tar.bz2
Zero the allocated contents of reloc sections.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 10cf2ae..6b91d31 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -4013,8 +4013,10 @@ elf_link_size_reloc_section (abfd, rel_hdr, o)
rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
/* The contents field must last into write_object_contents, so we
- allocate it with bfd_alloc rather than malloc. */
- rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
+ allocate it with bfd_alloc rather than malloc. Also since we
+ cannot be sure that the contents will actually be filled in,
+ we zero the allocated space. */
+ rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return false;