Fixed a memory leak in BLE (issue #4753) (#4761)

* Fixed crash on delete after disconnect

* Fixed memory leak when getting characteristics

* Removed guard

Co-authored-by: ushiboy <ushiboy.dev@gmail.com>
This commit is contained in:
ushiboy 2021-02-16 08:50:24 +09:00 committed by GitHub
parent d964873840
commit e831680a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -60,6 +60,7 @@ BLEClient::~BLEClient() {
delete myPair.second;
}
m_servicesMap.clear();
m_servicesMapByInstID.clear();
} // ~BLEClient

View File

@ -52,6 +52,7 @@ BLERemoteCharacteristic::BLERemoteCharacteristic(
*/
BLERemoteCharacteristic::~BLERemoteCharacteristic() {
removeDescriptors(); // Release resources for any descriptor information we may have allocated.
free(m_rawData);
} // ~BLERemoteCharacteristic