From ebdd56c5bd4b5115f9626561123ac740dc874ade Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 21 Sep 2014 11:12:58 +0200 Subject: XCB: fix a memory leak An early return caused a leak of a new'd allocated object. Change-Id: I9fbc37238dd49066d24363a2e8ee8bf35b155301 Reviewed-by: Uli Schlachter Reviewed-by: Allan Sandfeld Jensen --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(m_xlib_display), id, &nrDevices); - if (nrDevices <= 0) + if (nrDevices <= 0) { + delete dev; return 0; + } int type = -1; int maxTouchPoints = 1; bool hasRelativeCoords = false; -- cgit v1.2.3