]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix: "Missing NULL check"
authorJacob Navia <jacob@jacob.remcomp.fr>
Wed, 13 Sep 2023 10:41:03 +0000 (11:41 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 13 Sep 2023 10:41:03 +0000 (11:41 +0100)
  * elf.c (_bfd_elf_init_reloc_shdr): Don't segfault on alloc fail.

bfd/ChangeLog
bfd/elf.c

index 20dd6ba9e8e33ca57b5125beb4cc4dc16ef081e2..4b0544a2ac9f9feac0c8732da911a9259b3578eb 100644 (file)
@@ -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
index d7109f14039509d4e87e596877aae93063b20f6c..fa8881e8ea69fc9473ca5d47f1507571aa78d693 100644 (file)
--- 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)