From 2712ce2e659f82168154d4533f53d2963ae82571 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 15 Oct 2017 11:13:29 -0600 Subject: Introduce new_bfd_ref This introduces a helper function, new_bfd_ref, that calls gdb_bfd_ref and returns a gdb_bfd_ref_ptr. Then it updates several places to use this. ChangeLog 2017-10-20 Tom Tromey * exec.c (exec_file_attach): Use new_bfd_ref. * symfile-mem.c (symbol_file_add_from_memory): Use new_bfd_ref. * gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr) (gdb_bfd_openw, gdb_bfd_openr_iovec, gdb_bfd_fdopenr): Use new_bfd_ref. * gdb_bfd.h (new_bfd_ref): New function. --- gdb/exec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gdb/exec.c') diff --git a/gdb/exec.c b/gdb/exec.c index 2fa543b7a42..326cfffe496 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -248,8 +248,7 @@ exec_file_attach (const char *filename, int from_tty) /* First, acquire a reference to the current exec_bfd. We release this at the end of the function; but acquiring it now lets the BFD cache return it if this call refers to the same file. */ - gdb_bfd_ref (exec_bfd); - gdb_bfd_ref_ptr exec_bfd_holder (exec_bfd); + gdb_bfd_ref_ptr exec_bfd_holder = new_bfd_ref (exec_bfd); /* Remove any previous exec file. */ exec_close (); -- cgit v1.2.1