struct gdbarch *gdbarch, struct obstack *obstack)
{
char *p;
- struct bfd * dll;
CORE_ADDR text_offset;
obstack_grow_str (obstack, "<library name=\"");
obstack_grow_str (obstack, p);
xfree (p);
obstack_grow_str (obstack, "\"><segment address=\"");
- dll = gdb_bfd_open (so_name, gnutarget, -1);
+ gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget, -1));
/* The following calls are OK even if dll is NULL.
The default value 0x1000 is returned by pe_text_section_offset
in that case. */
- text_offset = pe_text_section_offset (dll);
- gdb_bfd_unref (dll);
+ text_offset = pe_text_section_offset (dll.get ());
obstack_grow_str (obstack, paddress (gdbarch, load_addr + text_offset));
obstack_grow_str (obstack, "\"/></library>");
}