removed double delete of characteristics (#3521)

This commit is contained in:
crnchbng 2020-09-30 13:25:31 +02:00 committed by GitHub
parent 7b613c1238
commit 5999b7ba46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -302,13 +302,10 @@ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) {
* @return N/A. * @return N/A.
*/ */
void BLERemoteService::removeCharacteristics() { void BLERemoteService::removeCharacteristics() {
for (auto &myPair : m_characteristicMap) {
delete myPair.second;
//m_characteristicMap.erase(myPair.first); // Should be no need to delete as it will be deleted by the clear
}
m_characteristicMap.clear(); // Clear the map m_characteristicMap.clear(); // Clear the map
for (auto &myPair : m_characteristicMapByHandle) { for (auto &myPair : m_characteristicMapByHandle) {
delete myPair.second; delete myPair.second;
// delete the characteristics only once
} }
m_characteristicMapByHandle.clear(); // Clear the map m_characteristicMapByHandle.clear(); // Clear the map
} // removeCharacteristics } // removeCharacteristics