From 5999b7ba4686bf8a4fad30fa09801a32d0dafd80 Mon Sep 17 00:00:00 2001 From: crnchbng <45542295+crnchbng@users.noreply.github.com> Date: Wed, 30 Sep 2020 13:25:31 +0200 Subject: [PATCH] removed double delete of characteristics (#3521) --- libraries/BLE/src/BLERemoteService.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libraries/BLE/src/BLERemoteService.cpp b/libraries/BLE/src/BLERemoteService.cpp index 278e9c1c..3b5b52d7 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -302,13 +302,10 @@ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) { * @return N/A. */ 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 for (auto &myPair : m_characteristicMapByHandle) { delete myPair.second; + // delete the characteristics only once } m_characteristicMapByHandle.clear(); // Clear the map } // removeCharacteristics