public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Re: bfd_close and target free_cached_memory
@ 2023-06-02  0:12 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-06-02  0:12 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=63188cb5c3e2814d6527d0309af4db8634e8cdaa

commit 63188cb5c3e2814d6527d0309af4db8634e8cdaa
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 2 09:00:41 2023 +0930

    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:
---
 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..  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-02  0:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  0:12 [binutils-gdb] Re: bfd_close and target free_cached_memory Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).