1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-05 11:23:47 +01:00
This commit is contained in:
J. Nick Koston
2025-06-16 15:07:23 +02:00
parent 280960ac18
commit 58a697bed1
2 changed files with 9 additions and 5 deletions

View File

@@ -203,6 +203,7 @@ class BLEEvent {
break; break;
default: default:
// We only handle 4 GAP event types, others are dropped
break; break;
} }
} }

View File

@@ -42,14 +42,17 @@ template<uint8_t SIZE> class BLEEventPool {
RAMAllocator<BLEEvent> allocator(RAMAllocator<BLEEvent>::ALLOC_INTERNAL); RAMAllocator<BLEEvent> allocator(RAMAllocator<BLEEvent>::ALLOC_INTERNAL);
event = allocator.allocate(1); event = allocator.allocate(1);
if (event != nullptr) { if (event == nullptr) {
// Placement new to construct the object // Memory allocation failed
new (event) BLEEvent(); return nullptr;
this->total_created_++;
} }
// Placement new to construct the object
new (event) BLEEvent();
this->total_created_++;
} }
return event; // Will be nullptr if allocation failed return event;
} }
// Return an event to the pool // Return an event to the pool