Don't allow a queue size of 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2013-06-09 20:07:14 +10:00
parent 9d04f1df84
commit 89fabb4e57

View file

@ -173,6 +173,9 @@ queue_shift(struct libevdev *dev, struct input_event *ev)
static inline int static inline int
queue_alloc(struct libevdev *dev, size_t size) queue_alloc(struct libevdev *dev, size_t size)
{ {
if (size == 0)
return -ENOSPC;
dev->queue = calloc(size, sizeof(struct input_event)); dev->queue = calloc(size, sizeof(struct input_event));
if (!dev->queue) if (!dev->queue)
return -ENOSPC; return -ENOSPC;