From 7889b467f7c4ee2c727c1a929b86957c39dbc3e4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Jun 2013 17:26:50 +1000 Subject: [PATCH] Don't return the next element if the queue is full Signed-off-by: Peter Hutterer --- libevdev/libevdev-int.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libevdev/libevdev-int.h b/libevdev/libevdev-int.h index 911dc40..43cfe8a 100644 --- a/libevdev/libevdev-int.h +++ b/libevdev/libevdev-int.h @@ -214,6 +214,9 @@ queue_num_free_elements(struct libevdev *dev) static inline struct input_event * queue_next_element(struct libevdev *dev) { + if (dev->queue_next == dev->queue_size) + return NULL; + return &dev->queue[dev->queue_next]; } -- 2.7.4