aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Rossi <bob@brasko.net>2004-07-08 11:18:27 +0000
committerBob Rossi <bob@brasko.net>2004-07-08 11:18:27 +0000
commit09bcec8017520b4a55778f67fcacbf7e13b63234 (patch)
tree3ad1152910eba6941f68bf5d1795f2f3b9b8d7f4
parentbcc82369d233afc216faa4480bb549e121781bff (diff)
downloadgdb-09bcec8017520b4a55778f67fcacbf7e13b63234.zip
gdb-09bcec8017520b4a55778f67fcacbf7e13b63234.tar.gz
gdb-09bcec8017520b4a55778f67fcacbf7e13b63234.tar.bz2
Fix crash in symtab.c.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/symtab.c26
2 files changed, 19 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8f69450..5d84bf7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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:
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8fa7cec..cd6dd5d 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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;
+ }
+ }
}
}