From: Pawel Wasowski
Date: Wed, 19 Apr 2017 09:40:25 +0000 (+0200)
Subject: [Bluetooth] Fix for a memory leak
X-Git-Tag: submit/tizen/20170419.130254^2~1^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f5cfa872d0821ee155d1c61e4df51e69fe55d38;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Bluetooth] Fix for a memory leak
[Verification] Code compiles
Change-Id: Ie45718fa00d5841eb947e882c3ab694b8f79c285
Signed-off-by: Pawel Wasowski
---
diff --git a/src/bluetooth/bluetooth_gatt_service.cc b/src/bluetooth/bluetooth_gatt_service.cc
index 98d0b53c..f16fb927 100755
--- a/src/bluetooth/bluetooth_gatt_service.cc
+++ b/src/bluetooth/bluetooth_gatt_service.cc
@@ -398,6 +398,8 @@ void BluetoothGATTService::ReadValue(const picojson::value& args,
};
int ret = bt_gatt_client_read_value(handle, read_value, (void*)user_data);
if (BT_ERROR_NONE != ret) {
+ delete user_data;
+ user_data = nullptr;
LoggerE("Couldn't register callback for read value %d (%s)",
ret, get_error_message(ret));
}