From e4d202f1ce701171ea763911845584d27378cbf2 Mon Sep 17 00:00:00 2001 From: h2zero Date: Sun, 8 Jun 2025 16:43:56 -0600 Subject: [PATCH] [Bugfix] NimBLEScan delete. Calling NimBLEDevice::deint with the `clearAll` parameter set to `true` will delete the scan and any scan results but it was calling `clearall` which uses critical sections, this could cause a crash because the stack has already been de-initialized. --- src/NimBLEScan.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NimBLEScan.cpp b/src/NimBLEScan.cpp index eaad8cf..713c84a 100644 --- a/src/NimBLEScan.cpp +++ b/src/NimBLEScan.cpp @@ -41,7 +41,9 @@ NimBLEScan::NimBLEScan() * @brief Scan destructor, release any allocated resources. */ NimBLEScan::~NimBLEScan() { - clearResults(); + for (const auto& dev : m_scanResults.m_deviceVec) { + delete dev; + } } /**