Skip to content

Commit 5999b7b

Browse files
authored
removed double delete of characteristics (#3521)
1 parent 7b613c1 commit 5999b7b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Diff for: libraries/BLE/src/BLERemoteService.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,10 @@ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) {
302302
* @return N/A.
303303
*/
304304
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-
}
309305
m_characteristicMap.clear(); // Clear the map
310306
for (auto &myPair : m_characteristicMapByHandle) {
311307
delete myPair.second;
308+
// delete the characteristics only once
312309
}
313310
m_characteristicMapByHandle.clear(); // Clear the map
314311
} // removeCharacteristics

0 commit comments

Comments
 (0)