[PATCH 2/4] dix: fix dereference before null check

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 25 17:00:48 PDT 2012


Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/touch.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dix/touch.c b/dix/touch.c
index aa17faf..8799502 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -160,11 +160,13 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
     int i;
     TouchClassPtr t = dev->touch;
     DDXTouchPointInfoPtr ti = NULL;
-    Bool emulate_pointer = (t->mode == XIDirectTouch);
+    Bool emulate_pointer;
 
     if (!t)
         return NULL;
 
+    emulate_pointer = (t->mode == XIDirectTouch);
+
     /* Look for another active touchpoint with the same DDX ID. DDX
      * touchpoints must be unique. */
     if (TouchFindByDDXID(dev, ddx_id, FALSE))
-- 
1.7.10.2



More information about the xorg-devel mailing list