]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/coff64-rs6000.c
Replace bfd_alloc/bfd_malloc + memset with bfd_zalloc/bfd_zmalloc
[thirdparty/binutils-gdb.git] / bfd / coff64-rs6000.c
index 16b63d4f8ab5fafd48261a8cab0c60d759a27c2a..c7fe5ac5e73a1cb8c651fe0405cf5736d7c28c9b 100644 (file)
@@ -2264,12 +2264,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
   data_buffer_size = 0x0058 + initsz + finisz;
   data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
   data_buffer = NULL;
-  data_buffer = (bfd_byte *)bfd_malloc (data_buffer_size);
+  data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
   if (data_buffer == NULL)
     return false;
 
-  memset (data_buffer, 0, data_buffer_size);
-
   if (initsz)
     {
       val = 0x18;
@@ -2302,8 +2300,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld)
   if (true == rtld)
     string_table_size += strlen (rtld_name) + 1;
 
-  string_table = (bfd_byte *)bfd_malloc (string_table_size);
-  memset (string_table, 0, string_table_size);
+  string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
+  if (string_table == NULL)
+    return false;
+
   val = string_table_size;
   bfd_put_32 (abfd, val, &string_table[0]);
   st_tmp = string_table + 4;