1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00
This commit is contained in:
J. Nick Koston
2025-06-16 15:06:02 +02:00
parent 0640ff13aa
commit 280960ac18

View File

@@ -42,18 +42,14 @@ template<uint8_t SIZE> class BLEEventPool {
RAMAllocator<BLEEvent> allocator(RAMAllocator<BLEEvent>::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