public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] libctf: actually close bfds we have opened
Date: Tue, 08 Oct 2019 15:52:00 -0000	[thread overview]
Message-ID: <f046147d59aab0c8b6f00cd182f34b42ac8915e8@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT f046147d59aab0c8b6f00cd182f34b42ac8915e8 ***

commit f046147d59aab0c8b6f00cd182f34b42ac8915e8
Author:     Nick Alcock <nick.alcock@oracle.com>
AuthorDate: Mon Jul 29 17:02:48 2019 +0100
Commit:     Nick Alcock <nick.alcock@oracle.com>
CommitDate: Thu Oct 3 17:04:55 2019 +0100

    libctf: actually close bfds we have opened
    
    When we do a ctf_fdopen, we open things via bfd_fdopenr and set up a
    hook to close the bfd again... but then we never actually call that hook
    from anywhere, so we eventually leak every bfd we open.
    
    Fix this by calling the hook (if set) in ctf_arc_close.
    
    New in v3.
    
    libctf/
            * ctf-archive.c (ctf_arc_close): Call ctfi_bfd_close if set.
            * ctf-open-bfd.c (ctf_bfdclose): Fix comment.

diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 852ad6267c..ff9e6e52d2 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-30  Nick Alcock  <nick.alcock@oracle.com>
+
+	* ctf-archive.c (ctf_arc_close): Call ctfi_bfd_close if set.
+	* ctf-open-bfd.c (ctf_bfdclose): Fix comment.
+
 2019-07-30  Nick Alcock  <nick.alcock@oracle.com>
 
 	* ctf-open-bfd.c (ctf_fdopen): Call bfd_set_cacheable.
diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c
index 8de11d6d58..979641cc1e 100644
--- a/libctf/ctf-archive.c
+++ b/libctf/ctf-archive.c
@@ -436,6 +436,8 @@ ctf_arc_close (ctf_archive_t *arc)
   free ((void *) arc->ctfi_symsect.cts_data);
   /* Do not free the ctfi_strsect: it is bound to the bfd.  */
   free (arc->ctfi_data);
+  if (arc->ctfi_bfd_close)
+    arc->ctfi_bfd_close (arc);
   free (arc);
 }
 
diff --git a/libctf/ctf-open-bfd.c b/libctf/ctf-open-bfd.c
index 1083c87608..d17b72d2f0 100644
--- a/libctf/ctf-open-bfd.c
+++ b/libctf/ctf-open-bfd.c
@@ -66,7 +66,7 @@ ctf_new_archive_internal (int is_archive, struct ctf_archive *arc,
   return arci;
 }
 
-/* Free the BFD bits of a CTF file on ctf_file_close().  */
+/* Free the BFD bits of a CTF file on ctf_arc_close().  */
 
 static void
 ctf_bfdclose (struct ctf_archive_internal *arci)


             reply	other threads:[~2019-10-08 15:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 15:52 gdb-buildbot [this message]
2019-10-08 15:52 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-10-08 18:08 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-10-11 17:14 ` Failures on Fedora-i686, " gdb-buildbot
2019-10-11 17:35 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-10-11 18:01 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-10-11 18:29 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-10-11 19:43 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f046147d59aab0c8b6f00cd182f34b42ac8915e8@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).