diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-08-20 08:44:49 +0000 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2015-08-20 13:08:45 +0000 |
commit | 973c4c0f951395e4b8a02dc14bbc17f35838ea15 (patch) | |
tree | 31296452a3f4e98257ece6a2495182e4d083bc40 /src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | |
parent | b074cb8a42d9f4ea83806617b5a58d06b68739c7 (diff) |
bluez: Fix some memory leaks on device discovery.
QDBusPendingCallWatcher will leak if it isn't deleted.
Change-Id: I5571dfbc087f54308193dc89127e974e6d2e9275
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index f66603a9..d186eafc 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -354,8 +354,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::stop() void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWatcher *watcher) { - if (!adapter) + if (!adapter) { + watcher->deleteLater(); return; + } Q_Q(QBluetoothServiceDiscoveryAgent); @@ -364,6 +366,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << "created" << address.toString(); QDBusPendingReply<QDBusObjectPath> deviceObjectPath = *watcher; + watcher->deleteLater(); if (deviceObjectPath.isError()) { if (deviceObjectPath.error().name() != QStringLiteral("org.bluez.Error.AlreadyExists")) { delete adapter; @@ -488,8 +491,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa // Bluez 4 void QBluetoothServiceDiscoveryAgentPrivate::_q_discoveredServices(QDBusPendingCallWatcher *watcher) { - if (!device) + if (!device) { + watcher->deleteLater(); return; + } qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO; Q_Q(QBluetoothServiceDiscoveryAgent); |