From f046147d59aab0c8b6f00cd182f34b42ac8915e8 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 29 Jul 2019 17:02:48 +0100 Subject: 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. --- libctf/ctf-open-bfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libctf/ctf-open-bfd.c') diff --git a/libctf/ctf-open-bfd.c b/libctf/ctf-open-bfd.c index 1083c87..d17b72d 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) -- cgit v1.1