* [binutils-gdb] Fix: "Missing NULL check"
@ 2023-09-13 10:41 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-09-13 10:41 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=38cc67cc00dc7385991e2658a1b4213d5ba3c4f0
commit 38cc67cc00dc7385991e2658a1b4213d5ba3c4f0
Author: Jacob Navia <jacob@jacob.remcomp.fr>
Date: Wed Sep 13 11:41:03 2023 +0100
Fix: "Missing NULL check"
* elf.c (_bfd_elf_init_reloc_shdr): Don't segfault on alloc fail.
Diff:
---
bfd/ChangeLog | 4 ++++
bfd/elf.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 20dd6ba9e8e..4b0544a2ac9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2023-09-13 Jacob Navia <jacob@jacob.remcomp.fr>
+
+ * elf.c (_bfd_elf_init_reloc_shdr): Don't segfault on alloc fail.
+
2023-09-13 Alan Modra <amodra@gmail.com>
* elf-strtab.c (_bfd_elf_strtab_init): In the event of memory
diff --git a/bfd/elf.c b/bfd/elf.c
index d7109f14039..fa8881e8ea6 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3659,6 +3659,8 @@ _bfd_elf_init_reloc_shdr (bfd *abfd,
BFD_ASSERT (reldata->hdr == NULL);
rel_hdr = bfd_zalloc (abfd, sizeof (*rel_hdr));
+ if (rel_hdr == NULL)
+ return false;
reldata->hdr = rel_hdr;
if (delay_st_name_p)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-13 10:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 10:41 [binutils-gdb] Fix: "Missing NULL check" Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).