From 280960ac185a179d6641f334d260c1c5b99e0aff Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 16 Jun 2025 15:06:02 +0200 Subject: [PATCH] cleanup --- esphome/components/esp32_ble/ble_event_pool.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/esphome/components/esp32_ble/ble_event_pool.h b/esphome/components/esp32_ble/ble_event_pool.h index 21f1114608..df92c138c3 100644 --- a/esphome/components/esp32_ble/ble_event_pool.h +++ b/esphome/components/esp32_ble/ble_event_pool.h @@ -42,18 +42,14 @@ template class BLEEventPool { RAMAllocator allocator(RAMAllocator::ALLOC_INTERNAL); event = allocator.allocate(1); - if (event == nullptr) { - // Fall back to regular allocation - event = new BLEEvent(); - } else { + if (event != nullptr) { // Placement new to construct the object new (event) BLEEvent(); + this->total_created_++; } - - this->total_created_++; } - return event; + return event; // Will be nullptr if allocation failed } // Return an event to the pool