summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2017-06-01 17:22:05 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2017-06-13 05:35:30 +0000
commitbfeed6bbcdddc7988e5bef13a36998eae084d7b4 (patch)
treebacfcf1accbc576c3c32f5c3e3ff4af5b9d13729 /src
parent50d1b99a89ed65d80a60a8d2f1c91c5ab4b80371 (diff)
Fix possible leaking of system handles
Change-Id: Ib702e7aa95a26212e1713b514adb5e6c81e9bbd7 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qlowenergycontroller_win.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_win.cpp b/src/bluetooth/qlowenergycontroller_win.cpp
index b22e64d1..02b03297 100644
--- a/src/bluetooth/qlowenergycontroller_win.cpp
+++ b/src/bluetooth/qlowenergycontroller_win.cpp
@@ -938,6 +938,7 @@ void QLowEnergyControllerPrivate::readCharacteristic(
const QByteArray characteristicValue = getGattCharacteristicValue(
hService, &gattCharacteristic, &systemErrorCode);
+ closeSystemDevice(hService);
if (systemErrorCode != NO_ERROR) {
qCWarning(QT_BT_WINDOWS) << "Unable to get value for characteristic"
@@ -991,6 +992,7 @@ void QLowEnergyControllerPrivate::writeCharacteristic(
// with use QFutureWatcher.
setGattCharacteristicValue(hService, &gattCharacteristic,
newValue, flags, &systemErrorCode);
+ closeSystemDevice(hService);
if (systemErrorCode != NO_ERROR) {
qCWarning(QT_BT_WINDOWS) << "Unable to set value for characteristic"
@@ -1044,9 +1046,9 @@ void QLowEnergyControllerPrivate::readDescriptor(
const QByteArray value = getGattDescriptorValue(
hService, const_cast<PBTH_LE_GATT_DESCRIPTOR>(
&gattDescriptor), &systemErrorCode);
+ closeSystemDevice(hService);
if (systemErrorCode != NO_ERROR) {
- closeSystemDevice(hService);
qCWarning(QT_BT_WINDOWS) << "Unable to get value for descriptor"
<< dscrDetails.uuid.toString()
<< "for characteristic"
@@ -1132,8 +1134,9 @@ void QLowEnergyControllerPrivate::writeDescriptor(
}
}
+ closeSystemDevice(hService);
+
if (systemErrorCode != NO_ERROR) {
- closeSystemDevice(hService);
qCWarning(QT_BT_WINDOWS) << "Unable to subscribe events for descriptor"
<< dscrDetails.uuid.toString()
<< "for characteristic"
@@ -1143,6 +1146,8 @@ void QLowEnergyControllerPrivate::writeDescriptor(
service->setError(QLowEnergyService::DescriptorWriteError);
return;
}
+ } else {
+ closeSystemDevice(hService);
}
updateValueOfDescriptor(charHandle, descriptorHandle, newValue, false);