aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile-mem.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-15 11:13:29 -0600
committerTom Tromey <tom@tromey.com>2017-10-20 09:01:03 -0600
commit2712ce2e659f82168154d4533f53d2963ae82571 (patch)
tree99edd1b85f5c282622f27a25a5411abeb657c7ef /gdb/symfile-mem.c
parent15763a09d4aea85fc3153d6746c040dd48565637 (diff)
downloadgdb-2712ce2e659f82168154d4533f53d2963ae82571.zip
gdb-2712ce2e659f82168154d4533f53d2963ae82571.tar.gz
gdb-2712ce2e659f82168154d4533f53d2963ae82571.tar.bz2
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 <tom@tromey.com> * 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.
Diffstat (limited to 'gdb/symfile-mem.c')
-rw-r--r--gdb/symfile-mem.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 5338bdb..4ce315d 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -101,9 +101,8 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
if (nbfd == NULL)
error (_("Failed to read a valid object file image from memory."));
- gdb_bfd_ref (nbfd);
/* Manage the new reference for the duration of this function. */
- gdb_bfd_ref_ptr nbfd_holder (nbfd);
+ gdb_bfd_ref_ptr nbfd_holder = new_bfd_ref (nbfd);
xfree (bfd_get_filename (nbfd));
if (name == NULL)