summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-02 19:21:52 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-02 19:21:52 +0000
commite2bea6a0278f182f9cc8b7bac660da49d24d2e50 (patch)
tree7b8237651309a8264142c7ce54e6ae197216b1d1 /parse.c
parentfbb0a1b59b410a5873cf33c4cedc32f32ea03a59 (diff)
downloadxorg-util-makedepend-e2bea6a0278f182f9cc8b7bac660da49d24d2e50.tar.gz
Coverity #925: Pointer "file" dereferenced before NULL checkmakedepend-1.0.1
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 935c61d..5248293 100644
--- a/parse.c
+++ b/parse.c
@@ -429,9 +429,14 @@ struct symtab **
slookup(char *symbol, struct inclist *file)
{
register int first = 0;
- register int last = file->i_ndefs - 1;
+ register int last;
- if (file) while (last >= first)
+ if (file == NULL)
+ return NULL;
+
+ last = file->i_ndefs - 1;
+
+ while (last >= first)
{
/* Fast inline binary search */
register char *s1;