aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-02 09:00:41 +0930
committerAlan Modra <amodra@gmail.com>2023-06-02 09:41:49 +0930
commit63188cb5c3e2814d6527d0309af4db8634e8cdaa (patch)
tree8f76c8fe03fc8f2d312b16ee44bf406393ab0bf4 /bfd/opncls.c
parente0ce6dde97881435d33652572789b94c846cacde (diff)
downloadgdb-63188cb5c3e2814d6527d0309af4db8634e8cdaa.zip
gdb-63188cb5c3e2814d6527d0309af4db8634e8cdaa.tar.gz
gdb-63188cb5c3e2814d6527d0309af4db8634e8cdaa.tar.bz2
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.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index b0c23b4..7cb09a1 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.. */