Reported by parfait 1.1 code analyzer:
Error: Null pointer dereference (CWE 476)
Read from null pointer 'p'
at line 746 of hw/xfree86/common/xf86Option.c in function
'xf86TokenToOptName'.
Function 'xf86TokenToOptinfo' may return constant 'NULL' at line 721,
called at line 745.
Null pointer introduced at line 721 in function 'xf86TokenToOptinfo'.
Signed-off-by: Alan Coopersmith <[email protected]>
---
hw/xfree86/common/xf86Option.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 40c9d15..607c333 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -743,7 +743,7 @@ xf86TokenToOptName(const OptionInfoRec * table, int token)
const OptionInfoRec *p;
p = xf86TokenToOptinfo(table, token);
- return p->name;
+ return p ? p->name : NULL;
}
Bool
--
1.7.9.2
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel