From 0f5cfa872d0821ee155d1c61e4df51e69fe55d38 Mon Sep 17 00:00:00 2001
From: Pawel Wasowski
Date: Wed, 19 Apr 2017 11:40:25 +0200
Subject: [PATCH] [Bluetooth] Fix for a memory leak
[Verification] Code compiles
Change-Id: Ie45718fa00d5841eb947e882c3ab694b8f79c285
Signed-off-by: Pawel Wasowski
---
src/bluetooth/bluetooth_gatt_service.cc | 2 ++
1 file changed, 2 insertions(+)
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));
}
--
2.34.1