aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJacob Navia <jacob@jacob.remcomp.fr>2023-09-13 11:41:03 +0100
committerNick Clifton <nickc@redhat.com>2023-09-13 11:41:03 +0100
commit38cc67cc00dc7385991e2658a1b4213d5ba3c4f0 (patch)
tree6e52191efced8178c34f4ec68a491873381d6b00 /bfd
parent452855278aa4789c5a7b87767e55de2c5a9938cf (diff)
downloadgdb-38cc67cc00dc7385991e2658a1b4213d5ba3c4f0.zip
gdb-38cc67cc00dc7385991e2658a1b4213d5ba3c4f0.tar.gz
gdb-38cc67cc00dc7385991e2658a1b4213d5ba3c4f0.tar.bz2
Fix: "Missing NULL check"
* elf.c (_bfd_elf_init_reloc_shdr): Don't segfault on alloc fail.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 20dd6ba..4b0544a 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 d7109f1..fa8881e 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)