We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7b613c1 commit 5999b7bCopy full SHA for 5999b7b
libraries/BLE/src/BLERemoteService.cpp
@@ -302,13 +302,10 @@ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) {
302
* @return N/A.
303
*/
304
void BLERemoteService::removeCharacteristics() {
305
- for (auto &myPair : m_characteristicMap) {
306
- delete myPair.second;
307
- //m_characteristicMap.erase(myPair.first); // Should be no need to delete as it will be deleted by the clear
308
- }
309
m_characteristicMap.clear(); // Clear the map
310
for (auto &myPair : m_characteristicMapByHandle) {
311
delete myPair.second;
+ // delete the characteristics only once
312
}
313
m_characteristicMapByHandle.clear(); // Clear the map
314
} // removeCharacteristics
0 commit comments