1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 15:55:46 +00:00

Always abort on allocation when out-of-memory (#2129)

Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Oxan van Leeuwen
2021-08-10 10:46:46 +02:00
committed by GitHub
parent f26767b65e
commit c6c2842bdb
3 changed files with 12 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ const Color COLOR_OFF(0, 0, 0, 0);
const Color COLOR_ON(255, 255, 255, 255);
void DisplayBuffer::init_internal_(uint32_t buffer_length) {
this->buffer_ = new uint8_t[buffer_length];
this->buffer_ = new (std::nothrow) uint8_t[buffer_length];
if (this->buffer_ == nullptr) {
ESP_LOGE(TAG, "Could not allocate buffer for display!");
return;