diff options
author | Tom Tromey <tromey@redhat.com> | 2012-07-18 19:38:39 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-07-18 19:38:39 +0000 |
commit | d6ad71ba41afb220549d1c7fe61edd6bddd128ad (patch) | |
tree | bd5c076fbabda8c8d31b3ec64689f40213168276 /gdb/solib-darwin.c | |
parent | a4453b7e0b9b84dd18c844ef43fbb9f6e2e75433 (diff) | |
download | gdb-d6ad71ba41afb220549d1c7fe61edd6bddd128ad.zip gdb-d6ad71ba41afb220549d1c7fe61edd6bddd128ad.tar.gz gdb-d6ad71ba41afb220549d1c7fe61edd6bddd128ad.tar.bz2 |
* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.
(pmon_load_fast): Likewise.
* m32r-rom.c (m32r_load): Use make_cleanup_bfd_close.
(m32r_upload_command): Likewise.
* dsrec.c (load_srec): Use make_cleanup_bfd_close.
* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
Use make_cleanup_bfd_close.
Diffstat (limited to 'gdb/solib-darwin.c')
-rw-r--r-- | gdb/solib-darwin.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 242f8cc..8d8da7e 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -357,6 +357,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) gdb_byte *interp_name; CORE_ADDR load_addr = 0; bfd *dyld_bfd = NULL; + struct cleanup *cleanup; /* This method doesn't work with an attached process. */ if (current_inferior ()->attach_flag) @@ -367,24 +368,30 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) if (!interp_name) return; + cleanup = make_cleanup (null_cleanup, NULL); + /* Create a bfd for the interpreter. */ dyld_bfd = gdb_bfd_ref (bfd_openr (interp_name, gnutarget)); if (dyld_bfd) { bfd *sub; + make_cleanup_bfd_close (dyld_bfd); sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object, gdbarch_bfd_arch_info (target_gdbarch)); if (sub) - dyld_bfd = sub; - else { - gdb_bfd_unref (dyld_bfd); - dyld_bfd = NULL; + dyld_bfd = gdb_bfd_ref (sub); + make_cleanup_bfd_close (sub); } + else + dyld_bfd = NULL; } if (!dyld_bfd) - return; + { + do_cleanups (cleanup); + return; + } /* We find the dynamic linker's base address by examining the current pc (which should point at the entry point for the @@ -396,7 +403,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) info->all_image_addr = lookup_symbol_from_bfd (dyld_bfd, "_dyld_all_image_infos"); - gdb_bfd_unref (dyld_bfd); + do_cleanups (cleanup); if (info->all_image_addr == 0) return; |