summaryrefslogtreecommitdiff
path: root/bfd/compress.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-12-14 11:50:12 +0000
committerNick Clifton <nickc@redhat.com>2011-12-14 11:50:12 +0000
commit01355e5a532d771b672c2a23b2f5ce01eeaa996c (patch)
tree65d84717535ca41969ba37ca06761e1871da7c50 /bfd/compress.c
parente3cfd1c952860576081c344fdcfdedb081ae0b53 (diff)
downloadgdb-01355e5a532d771b672c2a23b2f5ce01eeaa996c.tar.gz
PR ld/12451
* elfcode.h (elf_checksum_contents): Read in the section's contents if they are not already available. * compress.c (bfd_get_full_section_contents): Use zmalloc to allocate the buffers so that excess bytes are guaranteed to be zero.
Diffstat (limited to 'bfd/compress.c')
-rw-r--r--bfd/compress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/compress.c b/bfd/compress.c
index a82a8bc9e3c..713e30adc3f 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -181,7 +181,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
case COMPRESS_SECTION_NONE:
if (p == NULL)
{
- p = (bfd_byte *) bfd_malloc (sz);
+ p = (bfd_byte *) bfd_zmalloc (sz);
if (p == NULL)
return FALSE;
}
@@ -221,7 +221,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
if (!ret)
goto fail_compressed;
- uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
+ uncompressed_buffer = (bfd_byte *) bfd_zmalloc (uncompressed_size);
if (uncompressed_buffer == NULL)
goto fail_compressed;