* 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.
This commit is contained in:
Tom Tromey
2012-07-23 14:58:44 +00:00
parent 64c311498e
commit 8ac244b433
11 changed files with 56 additions and 20 deletions

View File

@ -653,13 +653,14 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
char *debugfile;
debugfile = find_separate_debug_file_by_debuglink (objfile);
make_cleanup (xfree, debugfile);
if (debugfile)
{
bfd *abfd = symfile_bfd_open (debugfile);
make_cleanup_bfd_unref (abfd);
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
}