Check for allocation failure in libevdev_new()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2013-05-31 11:26:01 +10:00
parent 05ba468a27
commit 8bdd0639a6

View file

@ -149,6 +149,8 @@ libevdev_new(int fd)
struct libevdev *dev;
dev = calloc(1, sizeof(*dev));
if (!dev)
return NULL;
dev->num_slots = -1;
dev->current_slot = -1;
dev->log = libevdev_noop_log_func;