[xf86-input-synaptics v3 01/14] Check if proto_data is valid before derefencing members

Chase Douglas chase.douglas at canonical.com
Fri Feb 10 11:56:45 PST 2012


proto_data is NULL when run through eventcomm-test.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/eventcomm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index ce26934..a52e8b8 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -502,7 +502,7 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
     ssize_t len;
 
 #ifdef HAVE_MTDEV
-    if (proto_data->mtdev)
+    if (proto_data && proto_data->mtdev)
         len = mtdev_get(proto_data->mtdev, pInfo->fd, ev, 1) *
               sizeof(struct input_event);
     else
@@ -598,7 +598,7 @@ EventProcessTouch(InputInfoPtr pInfo)
     SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
 
-    if (proto_data->cur_slot < 0 || !priv->has_touch)
+    if (!proto_data || proto_data->cur_slot < 0 || !priv->has_touch)
         return;
 
     /* If the ABS_MT_SLOT is the first event we get after EV_SYN, skip this */
-- 
1.7.8.3



More information about the xorg-devel mailing list