[PATCH] revolve possible null pointer dereference issue found by cppcheck

Ilya Shipitsin chipitsine at gmail.com
Mon Apr 9 07:31:54 UTC 2018


[dix/inpututils.c:909] -> [dix/inpututils.c:905]: (warning) Either the condition
'if(list)' is redundant or there is possible null pointer dereference: list.

Signed-off-by: Ilya Shipitsin <chipitsine at gmail.com>
---
 dix/inpututils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 6bff9efab..f4c386a24 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -902,7 +902,9 @@ input_option_new(InputOption *list, const char *key, const char *value)
     if (!opt)
         return NULL;
 
-    nt_list_init(opt, list.next);
+    if (list)
+        nt_list_init(opt, list.next);
+
     input_option_set_key(opt, key);
     input_option_set_value(opt, value);
 
-- 
2.14.3



More information about the xorg-devel mailing list