Segfault in _bfd_delete_bfd with USE_MMAP

Any of the calls to _bfd_delete_bfd in bfd_fopen will hit this.

	* opncls.c (_bfd_delete_bfd): Check for non-NULL xvec before
	accessing flavour.
This commit is contained in:
Alan Modra 2024-04-11 09:25:13 +09:30
parent f8e9374ea8
commit ea3002bc4d

View File

@ -164,7 +164,8 @@ static void
_bfd_delete_bfd (bfd *abfd)
{
#ifdef USE_MMAP
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
if (abfd->xvec
&& abfd->xvec->flavour == bfd_target_elf_flavour)
{
asection *sec;
for (sec = abfd->sections; sec != NULL; sec = sec->next)