summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-09-21 11:12:58 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-09-22 18:56:26 +0200
commitebdd56c5bd4b5115f9626561123ac740dc874ade (patch)
treec9557658945edc352a4ec7add3cf01f75f40ff18 /src/plugins/platforms/xcb
parent8259413e410b4291d1cef319c90718ff853a3ffc (diff)
XCB: fix a memory leak
An early return caused a leak of a new'd allocated object. Change-Id: I9fbc37238dd49066d24363a2e8ee8bf35b155301 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index b38f9d42a9..643a0351e3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -335,8 +335,10 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id)
QTouchDevice::Capabilities caps = 0;
dev = new XInput2DeviceData;
dev->xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), id, &nrDevices);
- if (nrDevices <= 0)
+ if (nrDevices <= 0) {
+ delete dev;
return 0;
+ }
int type = -1;
int maxTouchPoints = 1;
bool hasRelativeCoords = false;