]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Add missing C++ error check on dwarf_formstring calls.
authorRoland McGrath <roland@redhat.com>
Thu, 1 Oct 2009 20:59:53 +0000 (13:59 -0700)
committerRoland McGrath <roland@redhat.com>
Thu, 1 Oct 2009 20:59:53 +0000 (13:59 -0700)
libdw/ChangeLog
libdw/c++/line_info.cc

index 0259370d9b22395b740eeaa0e8285aacb87dc32f..b4899d1db5760e5d012b2c9713cef7ec73f835f4 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-01  Roland McGrath  <roland@redhat.com>
+
+       * c++/line_info.cc (dwarf::source_file::name): Check for failure
+       return from dwarf_formstring.
+       (dwarf::source_file::to_string): Likewise.
+
 2009-09-30  Roland McGrath  <roland@redhat.com>
 
        * c++/dwarf_tracker (dwarf_path_finder::walk::jump): New method.
index 676f81ff6c44d7e2f67b46ee7f5d92168aa3b998..b913da626bd20fae5bf236a46229795d9ba93b95 100644 (file)
@@ -121,14 +121,16 @@ dwarf::source_file::size () const
 const char *
 dwarf::source_file::name () const
 {
+  const char *result;
   if (stringform (thisattr ()))
-    return dwarf_formstring (thisattr ());
-
-  Dwarf_Files *files;
-  Dwarf_Word idx;
-  xif (thisattr (), get_files (thisattr (), &files, &idx));
-
-  const char *result = dwarf_filesrc (files, idx, NULL, NULL);
+    result = dwarf_formstring (thisattr ());
+  else
+    {
+      Dwarf_Files *files;
+      Dwarf_Word idx;
+      xif (thisattr (), get_files (thisattr (), &files, &idx));
+     result = dwarf_filesrc (files, idx, NULL, NULL);
+    }
   xif (thisattr (), result == NULL);
   return result;
 }
@@ -136,14 +138,21 @@ dwarf::source_file::name () const
 static inline string
 plain_string (const char *filename)
 {
-  return string ("\"") + filename + "\"";
+  string result ("\"");
+  result += filename;
+  result += "\"";
+  return result;
 }
 
 string
 dwarf::source_file::to_string () const
 {
   if (stringform (thisattr ()))
-    return plain_string (dwarf_formstring (thisattr ()));
+    {
+      const char *result = dwarf_formstring (thisattr ());
+      xif (thisattr (), result == NULL);
+      return plain_string (result);
+    }
 
   Dwarf_Files *files;
   Dwarf_Word idx;