Remove make_cleanup_discard_psymtabs
[deliverable/binutils-gdb.git] / gdb / elfread.c
index c6d0fdb7442d3b571db087213704db72878a70e3..2ca10f8fdd7e9aedd432a2fcb2027b622ac16c77 100644 (file)
@@ -1,6 +1,6 @@
 /* Read ELF (Executable and Linking Format) object files for GDB.
 
-   Copyright (C) 1991-2016 Free Software Foundation, Inc.
+   Copyright (C) 1991-2017 Free Software Foundation, Inc.
 
    Written by Fred Fish at Cygnus Support.
 
@@ -1265,21 +1265,18 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
           && objfile->separate_debug_objfile == NULL
           && objfile->separate_debug_objfile_backlink == NULL)
     {
-      char *debugfile;
-
-      debugfile = find_separate_debug_file_by_buildid (objfile);
+      gdb::unique_xmalloc_ptr<char> debugfile
+       (find_separate_debug_file_by_buildid (objfile));
 
       if (debugfile == NULL)
-       debugfile = find_separate_debug_file_by_debuglink (objfile);
+       debugfile.reset (find_separate_debug_file_by_debuglink (objfile));
 
-      if (debugfile)
+      if (debugfile != NULL)
        {
-         struct cleanup *cleanup = make_cleanup (xfree, debugfile);
-         bfd *abfd = symfile_bfd_open (debugfile);
+         gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.get ()));
 
-         make_cleanup_bfd_unref (abfd);
-         symbol_file_add_separate (abfd, debugfile, symfile_flags, objfile);
-         do_cleanups (cleanup);
+         symbol_file_add_separate (abfd.get (), debugfile.get (),
+                                   symfile_flags, objfile);
        }
     }
 }
This page took 0.026254 seconds and 4 git commands to generate.