1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-05 19:33: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;
default:
// We only handle 4 GAP event types, others are dropped
break;
}
}

View File

@@ -42,14 +42,17 @@ template<uint8_t SIZE> class BLEEventPool {
RAMAllocator<BLEEvent> allocator(RAMAllocator<BLEEvent>::ALLOC_INTERNAL);
event = allocator.allocate(1);
if (event != nullptr) {
if (event == nullptr) {
// Memory allocation failed
return nullptr;
}
// 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