[PATCH 05/12] xnest/keyboard: fix dereference before null check

Dave Airlie airlied at gmail.com
Thu Oct 20 03:44:21 PDT 2011


From: Dave Airlie <airlied at redhat.com>

pointed out by coverity.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xnest/Keyboard.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index ec629dc..c138438 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -207,7 +207,7 @@ void
 xnestUpdateModifierState(unsigned int state)
 {
   DeviceIntPtr pDev = xnestKeyboardDevice;
-  KeyClassPtr keyc = pDev->key;
+  KeyClassPtr keyc;
   int i;
   CARD8 mask;
   int xkb_state;
@@ -215,6 +215,7 @@ xnestUpdateModifierState(unsigned int state)
   if (!pDev)
       return;
 
+  keyc = pDev->key;
   xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
   state = state & 0xff;
 
-- 
1.7.6.4



More information about the xorg-devel mailing list