From: Alan Modra Date: Thu, 1 Jun 2023 23:30:41 +0000 (+0930) Subject: Re: bfd_close and target free_cached_memory X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63188cb5c3e2814d6527d0309af4db8634e8cdaa;p=binutils-gdb.git Re: bfd_close and target free_cached_memory _bfd_delete_bfd can be called early, before the target xvec is set up. * opncls.c (_bfd_delete_bfd): Don't segfault on NULL xvec. --- diff --git a/bfd/opncls.c b/bfd/opncls.c index b0c23b4201c..7cb09a108e5 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -157,7 +157,7 @@ static void _bfd_delete_bfd (bfd *abfd) { /* Give the target _bfd_free_cached_info a chance to free memory. */ - if (abfd->memory) + if (abfd->memory && abfd->xvec) bfd_free_cached_info (abfd); /* The target _bfd_free_cached_info may not have done anything.. */