GNU Binutils with patches for OS216
修訂 | bf05b84eda6ea5e903ed19fad4e509eca43a7267 (tree) |
---|---|
時間 | 2019-09-23 22:12:54 |
作者 | Nick Alcock <nick.alcock@orac...> |
Commiter | Nick Alcock |
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.
@@ -1,5 +1,10 @@ | ||
1 | 1 | 2019-07-30 Nick Alcock <nick.alcock@oracle.com> |
2 | 2 | |
3 | + * ctf-archive.c (ctf_arc_close): Call ctfi_bfd_close if set. | |
4 | + * ctf-open-bfd.c (ctf_bfdclose): Fix comment. | |
5 | + | |
6 | +2019-07-30 Nick Alcock <nick.alcock@oracle.com> | |
7 | + | |
3 | 8 | * ctf-open-bfd.c (ctf_fdopen): Call bfd_set_cacheable. |
4 | 9 | |
5 | 10 | 2019-07-13 Nick Alcock <nick.alcock@oracle.com> |
@@ -436,6 +436,8 @@ ctf_arc_close (ctf_archive_t *arc) | ||
436 | 436 | free ((void *) arc->ctfi_symsect.cts_data); |
437 | 437 | /* Do not free the ctfi_strsect: it is bound to the bfd. */ |
438 | 438 | free (arc->ctfi_data); |
439 | + if (arc->ctfi_bfd_close) | |
440 | + arc->ctfi_bfd_close (arc); | |
439 | 441 | free (arc); |
440 | 442 | } |
441 | 443 |
@@ -66,7 +66,7 @@ ctf_new_archive_internal (int is_archive, struct ctf_archive *arc, | ||
66 | 66 | return arci; |
67 | 67 | } |
68 | 68 | |
69 | -/* Free the BFD bits of a CTF file on ctf_file_close(). */ | |
69 | +/* Free the BFD bits of a CTF file on ctf_arc_close(). */ | |
70 | 70 | |
71 | 71 | static void |
72 | 72 | ctf_bfdclose (struct ctf_archive_internal *arci) |