From 63188cb5c3e2814d6527d0309af4db8634e8cdaa Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 2 Jun 2023 09:00:41 +0930 Subject: [PATCH] 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. --- bfd/opncls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.. */ -- 2.30.2