Fix thinko in recent update to bfd_section_from_shdr.
authorGunther Nikl <gnikl@justmail.de>
Tue, 19 May 2020 16:32:26 +0000 (17:32 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 19 May 2020 16:32:26 +0000 (17:32 +0100)
PR 26005
* elf.c (bfd_section_from_shdr): Replace bfd_malloc + memset with
bfd_zmalloc to allocate memory for the sections_being_created array.

bfd/ChangeLog
bfd/elf.c

index 7ec1ce3e86316ab8c0549c506eaa392cf41cdfc1..cb168f17684ef55ae2c784cb690ff56ba87de946 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-19  Gunther Nikl  <gnikl@justmail.de>
+
+       PR 26005
+       * elf.c (bfd_section_from_shdr): Replace bfd_malloc + memset with
+       bfd_zmalloc to allocate memory for the sections_being_created array.
+
 2020-05-19  Stafford Horne  <shorne@gmail.com>
 
        * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela
index c74d95b442de0636fef37102b77540b6ab58b2f4..40943781bcd8ba8c4cadb17b55398134bdbfbd78 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2075,9 +2075,9 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
          /* PR 26005: Do not use bfd_zalloc here as the memory might
             be released before the bfd has been fully scanned.  */
          sections_being_created = (bfd_boolean *) bfd_malloc (amt);
-         memset (sections_being_created, FALSE, amt);
          if (sections_being_created == NULL)
            return FALSE;
+         memset (sections_being_created, FALSE, amt);
          sections_being_created_abfd = abfd;
        }
       if (sections_being_created [shindex])