aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile-mem.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-23 14:58:44 +0000
committerTom Tromey <tromey@redhat.com>2012-07-23 14:58:44 +0000
commit8ac244b433d5d36b787afd36f7144069e7d837e0 (patch)
treedccbc64cbec657281a84c4d8e07d96df3e508661 /gdb/symfile-mem.c
parent64c311498e46cef6b70aa88577e7d7c382e0f7cc (diff)
downloadgdb-8ac244b433d5d36b787afd36f7144069e7d837e0.zip
gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.tar.gz
gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.tar.bz2
* coffread.c (coff_symfile_read): Make a cleanup for 'debugfile'
and 'abfd'. * elfread.c (elf_symfile_read): Make a cleanup for 'debugfile' and 'abfd'. * jit.c (jit_bfd_try_read_symtab): Make a cleanup for 'nbfd'. * machoread.c (macho_add_oso_symfile): Make a cleanup for 'abfd'. (macho_symfile_read): Make a cleanup for 'dsym_bfd'. * objfiles.c (allocate_objfile): Acquire a new reference. * rs6000-nat.c (add_vmap): Don't acquire a BFD reference. * solib.c (solib_read_symbols): Don't acquire a BFD reference. * spu-linux-nat.c (spu_symbol_file_add_from_memory): Make a cleanup for 'nbfd'. * symfile-mem.c (symbol_file_add_from_memory): Make a cleanup for 'nbfd'. * symfile.c (symbol_file_add_with_addrs_or_offsets): Don't make a cleanup for 'abfd'. (symbol_file_add): Make a BFD cleanup.
Diffstat (limited to 'gdb/symfile-mem.c')
-rw-r--r--gdb/symfile-mem.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index ad87abd..2e53be0 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -111,15 +111,14 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
xfree (name);
}
+ cleanup = make_cleanup_bfd_unref (nbfd);
+
if (!bfd_check_format (nbfd, bfd_object))
- {
- make_cleanup_bfd_unref (nbfd);
- error (_("Got object file from memory but can't read symbols: %s."),
- bfd_errmsg (bfd_get_error ()));
- }
+ error (_("Got object file from memory but can't read symbols: %s."),
+ bfd_errmsg (bfd_get_error ()));
sai = alloc_section_addr_info (bfd_count_sections (nbfd));
- cleanup = make_cleanup (xfree, sai);
+ make_cleanup (xfree, sai);
i = 0;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0)