* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.
[deliverable/binutils-gdb.git] / gdb / cli / cli-dump.c
index 1b2b5d4d4e67a5c6bf57d15275c289b91843cddf..7dce32ac2f529e28ba9fc1d05a4951c9921a3233 100644 (file)
@@ -1,7 +1,6 @@
 /* Dump-to-file commands, for GDB, the GNU debugger.
 
-   Copyright (c) 2002, 2005, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (c) 2002, 2005, 2007-2012 Free Software Foundation, Inc.
 
    Contributed by Red Hat.
 
@@ -33,6 +32,7 @@
 #include "readline/readline.h"
 #include "gdbcore.h"
 #include "cli/cli-utils.h"
+#include "gdb_bfd.h"
 
 #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
 
@@ -112,7 +112,7 @@ bfd_openr_with_cleanup (const char *filename, const char *target)
 {
   bfd *ibfd;
 
-  ibfd = bfd_openr (filename, target);
+  ibfd = gdb_bfd_ref (bfd_openr (filename, target));
   if (ibfd == NULL)
     error (_("Failed to open %s: %s."), filename, 
           bfd_errmsg (bfd_get_error ()));
@@ -132,7 +132,7 @@ bfd_openw_with_cleanup (const char *filename, const char *target,
 
   if (*mode == 'w')    /* Write: create new file */
     {
-      obfd = bfd_openw (filename, target);
+      obfd = gdb_bfd_ref (bfd_openw (filename, target));
       if (obfd == NULL)
        error (_("Failed to open %s: %s."), filename, 
               bfd_errmsg (bfd_get_error ()));
This page took 0.024804 seconds and 4 git commands to generate.