Fix: "Missing NULL check"

* elf.c (_bfd_elf_init_reloc_shdr): Don't segfault on alloc fail.
This commit is contained in:
Jacob Navia
2023-09-13 11:41:03 +01:00
committed by Nick Clifton
parent 452855278a
commit 38cc67cc00
2 changed files with 6 additions and 0 deletions

View 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

View File

@@ -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)