on xenial help sign in
Fix leaks in QInputDeviceManagerPrivate::addDevice
2a817fcAlbert Astals Cid
plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp+5
@@ -44,6 +44,7 @@
44#include <libudev.h>
44#include <libudev.h>
45#include <libevdev/libevdev.h>
45#include <libevdev/libevdev.h>
46#include <fcntl.h>
46#include <fcntl.h>
47+#include <unistd.h>
47#include <QDebug>
48#include <QDebug>
48#include <QSocketNotifier>
49#include <QSocketNotifier>
49#include <QTimer>
50#include <QTimer>
@@ -168,6 +169,7 @@ QInputDevice *QInputDeviceManagerPrivate::addDevice(struct udev_device *udev)
168 rc = libevdev_new_from_fd(fd, &dev);
169 rc = libevdev_new_from_fd(fd, &dev);
169 if (rc < 0) {
170 if (rc < 0) {
170 qWarning() << "Failed to init libevdev ("<< strerror(-rc) << ")";
171 qWarning() << "Failed to init libevdev ("<< strerror(-rc) << ")";
172+ close(fd);
171 return Q_NULLPTR;
173 return Q_NULLPTR;
172 }
174 }
173
175
@@ -195,6 +197,9 @@ QInputDevice *QInputDeviceManagerPrivate::addDevice(struct udev_device *udev)
195 }
197 }
196 }
198 }
197
199
200+ qDebug() << "MOOOOOOOOO";
201+ libevdev_free(dev);
202+ close(fd);
198 return inputDevice;
203 return inputDevice;
199}
204}
200
205