summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-08-18 14:52:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-08-19 14:14:30 +1000
commit7c64781598abfb1382a7f3e48480f07b8999a332 (patch)
tree7e70ad2c50f5d7245c38ed8ddc0aab9b1c9cbde6
parenteba96a4d2be7260b5843e65c4b99c8b06a1f4c9d (diff)
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 <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
-rw-r--r--src/evemu.c3
1 files changed, 3 insertions, 0 deletions
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);