From 7c64781598abfb1382a7f3e48480f07b8999a332 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 18 Aug 2015 14:52:04 +1000 Subject: Ignore NULL in evemu_destroy() Makes the cleanup path nicer and stops coverity warnings. The tools all call evemu_destroy() unconditionally, even when evemu_create() failed. Signed-off-by: Peter Hutterer Reviewed-by: Benjamin Tissoires --- src/evemu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/evemu.c b/src/evemu.c index ee24631..6edc4d5 100644 --- a/src/evemu.c +++ b/src/evemu.c @@ -135,6 +135,9 @@ struct evemu_device *evemu_new(const char *name) void evemu_delete(struct evemu_device *dev) { + if (dev == NULL) + return; + if (dev->uidev) evemu_destroy(dev); libevdev_free(dev->evdev); -- cgit v1.2.3