From d7c5c44b7d22f0b2b40602844ad83ea6ab59da69 Mon Sep 17 00:00:00 2001 From: Jarik Poplavski Date: Tue, 5 May 2020 21:06:37 +0200 Subject: [PATCH] fixing incorrect clean-up in BLERemoteService::removeCharacteristics(), causing heap corruption crash when deleting BLEClient instances --- libraries/BLE/src/BLERemoteService.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/BLE/src/BLERemoteService.cpp b/libraries/BLE/src/BLERemoteService.cpp index 278e9c1cab4..2e3bd032e36 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -304,12 +304,8 @@ std::string BLERemoteService::getValue(BLEUUID characteristicUuid) { 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; - } m_characteristicMapByHandle.clear(); // Clear the map } // removeCharacteristics