summaryrefslogtreecommitdiffstats
path: root/tdekbdledsync
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2017-03-25 17:40:43 +0100
committerSlávek Banko <slavek.banko@axis.cz>2017-03-25 17:40:54 +0100
commit45596ac8e456675863814b2a6eb052abb361cad0 (patch)
tree438bd54cccfa6c5810bf15a43e70ad7930d05ac6 /tdekbdledsync
parent790f681ae22c49ca313f4238a2c6c807a838f4fa (diff)
downloadtdebase-45596ac8e456675863814b2a6eb052abb361cad0.tar.gz
tdebase-45596ac8e456675863814b2a6eb052abb361cad0.zip
Fix memory leak after processing udev
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 0a8417d4143eb680da726d3cb4384ad7ca898a15)
Diffstat (limited to 'tdekbdledsync')
-rw-r--r--tdekbdledsync/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tdekbdledsync/main.cpp b/tdekbdledsync/main.cpp
index 0f4075694..1dbf7ef73 100644
--- a/tdekbdledsync/main.cpp
+++ b/tdekbdledsync/main.cpp
@@ -467,11 +467,15 @@ int main() {
else {
dev = udev_monitor_receive_device(mon);
if (dev) {
+ int reload_keyboards = 0;
if (strcmp(udev_device_get_action(dev), "add") == 0) {
- // Reload keyboards
- break;
+ reload_keyboards = 1;
}
if (strcmp(udev_device_get_action(dev), "remove") == 0) {
+ reload_keyboards = 1;
+ }
+ udev_device_unref(dev);
+ if( reload_keyboards ) {
// Reload keyboards
break;
}
@@ -507,5 +511,7 @@ int main() {
}
releaseLock(lockfd, lockFileName);
+ udev_monitor_unref(mon);
+ udev_unref(udev);
return 0;
}