From 5fcdb8412d20962022d16dd449b1ebdf681b1031 Mon Sep 17 00:00:00 2001 From: Chester Date: Thu, 30 Nov 2023 20:26:23 +0800 Subject: [PATCH] Kernel panic when delete BLEClient object with descriptor characteristic (#8010) * Update BLERemoteCharacteristic.cpp Fix kernel panic issue when trying to release BLEClient when the target device have a ble descriptor. * Update BLERemoteCharacteristic.cpp Co-authored-by: Lucas Saavedra Vaz --------- Co-authored-by: Lucas Saavedra Vaz Co-authored-by: Lucas Saavedra Vaz --- libraries/BLE/src/BLERemoteCharacteristic.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/BLE/src/BLERemoteCharacteristic.cpp b/libraries/BLE/src/BLERemoteCharacteristic.cpp index 9854984cb..620951b66 100644 --- a/libraries/BLE/src/BLERemoteCharacteristic.cpp +++ b/libraries/BLE/src/BLERemoteCharacteristic.cpp @@ -520,10 +520,9 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback, void BLERemoteCharacteristic::removeDescriptors() { // Iterate through all the descriptors releasing their storage and erasing them from the map. for (auto &myPair : m_descriptorMap) { - m_descriptorMap.erase(myPair.first); delete myPair.second; } - m_descriptorMap.clear(); // Technically not neeeded, but just to be sure. + m_descriptorMap.clear(); } // removeCharacteristics