[PATCH evemu 1/7] Ignore NULL in evemu_destroy()
Peter Hutterer
peter.hutterer at who-t.net
Tue Aug 18 18:03:24 PDT 2015
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 at who-t.net>
---
src/evemu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/evemu.c b/src/evemu.c
index 0887ed1..b64f6f0 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -139,6 +139,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);
--
2.4.3
More information about the Input-tools
mailing list