From c261b6582c8e900dc49b0afb9c3071c9c910eefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Marussy?= Date: Mon, 14 Dec 2020 19:49:28 +0100 Subject: [PATCH] Cleanup in InputDevice --- src/logid/InputDevice.cpp | 4 +++- src/logid/InputDevice.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/logid/InputDevice.cpp b/src/logid/InputDevice.cpp index 30b448b..cc36e3b 100644 --- a/src/logid/InputDevice.cpp +++ b/src/logid/InputDevice.cpp @@ -54,8 +54,10 @@ InputDevice::InputDevice(const char* name) int err = libevdev_uinput_create_from_device(device, LIBEVDEV_UINPUT_OPEN_MANAGED, &ui_device); - if(err != 0) + if(err != 0) { + libevdev_free(device); throw std::system_error(-err, std::generic_category()); + } } InputDevice::~InputDevice() diff --git a/src/logid/InputDevice.h b/src/logid/InputDevice.h index 8815d05..d5e5a47 100644 --- a/src/logid/InputDevice.h +++ b/src/logid/InputDevice.h @@ -20,6 +20,7 @@ #define LOGID_INPUTDEVICE_H #include +#include extern "C" {