Fix crash in symtab.c.
authorBob Rossi <bob@brasko.net>
Thu, 8 Jul 2004 11:18:27 +0000 (11:18 +0000)
committerBob Rossi <bob@brasko.net>
Thu, 8 Jul 2004 11:18:27 +0000 (11:18 +0000)
gdb/ChangeLog
gdb/symtab.c

index 8f694501ce4cce26e2bdab68b81239d24e2a95db..5d84bf7f5d6bfaf1e94b580a3c29281733616b1f 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-08  Bob Rossi  <bob@brasko.net>
+
+       * symtab.c (lookup_symtab): check return value of symtab_to_fullname
+
 2004-07-06  Jeff Johnston <jjohnstn@redhat.com>
 
        * language.h (struct_language_defn): Add new function pointer:
index 8fa7cecb7a5ddc32bd9592eaecac57e19ec64505..cd6dd5dd838b169c061ea3b2298a958fe7ae3b3c 100644 (file)
@@ -181,21 +181,25 @@ got_symtab:
     
     if (full_path != NULL)
       {
-       const char *fp = symtab_to_fullname (s);
-       if (FILENAME_CMP (full_path, fp) == 0)
-         {
-           return s;
-         }
+        const char *fp = symtab_to_fullname (s);
+        if (fp != NULL && FILENAME_CMP (full_path, fp) == 0)
+          {
+            return s;
+          }
       }
 
     if (real_path != NULL)
       {
-       char *rp = gdb_realpath (symtab_to_fullname (s));
-        make_cleanup (xfree, rp);
-       if (FILENAME_CMP (real_path, rp) == 0)
-         {
-           return s;
-         }
+        char *fullname = symtab_to_fullname (s);
+        if (fullname != NULL)
+          {
+            char *rp = gdb_realpath (fullname);
+            make_cleanup (xfree, rp);
+            if (FILENAME_CMP (real_path, rp) == 0)
+              {
+                return s;
+              }
+          }
       }
   }