[binutils-gdb] Fix thinko in recent update to bfd_section_from_shdr.
Nick Clifton
nickc@sourceware.org
Tue May 19 16:32:57 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6fd1d259e98354236fafd14ec05f3d6a377ede9f
commit 6fd1d259e98354236fafd14ec05f3d6a377ede9f
Author: Gunther Nikl <gnikl@justmail.de>
Date: Tue May 19 17:32:26 2020 +0100
Fix thinko in recent update to bfd_section_from_shdr.
PR 26005
* elf.c (bfd_section_from_shdr): Replace bfd_malloc + memset with
bfd_zmalloc to allocate memory for the sections_being_created array.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7ec1ce3e863..cb168f17684 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf.c b/bfd/elf.c
index c74d95b442d..40943781bcd 100644
--- 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])
More information about the Binutils-cvs
mailing list