Make find_separate_debug_file* return std::string
[deliverable/binutils-gdb.git] / gdb / coffread.c
index fbbbb68f71c430a8d647d98213189d6d06f7dbe2..cad3e7e2f1744f8ee238e7ef3a7eeb1085d9ebd6 100644 (file)
@@ -733,20 +733,17 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
   /* Try to add separate debug file if no symbols table found.   */
   if (!objfile_has_partial_symbols (objfile))
     {
-      char *debugfile;
+      std::string debugfile = find_separate_debug_file_by_buildid (objfile);
 
-      debugfile = find_separate_debug_file_by_buildid (objfile);
-
-      if (debugfile == NULL)
+      if (debugfile.empty ())
        debugfile = find_separate_debug_file_by_debuglink (objfile);
-      make_cleanup (xfree, debugfile);
 
-      if (debugfile)
+      if (!debugfile.empty ())
        {
-         gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile));
+         gdb_bfd_ref_ptr abfd (symfile_bfd_open (debugfile.c_str ()));
 
-         symbol_file_add_separate (abfd.get (), debugfile, symfile_flags,
-                                   objfile);
+         symbol_file_add_separate (abfd.get (), debugfile.c_str (),
+                                   symfile_flags, objfile);
        }
     }
 
This page took 0.038989 seconds and 4 git commands to generate.