mirror of
https://github.com/esphome/esphome.git
synced 2026-09-21 20:18:43 +00:00
guard
This commit is contained in:
@@ -96,6 +96,8 @@ OTAResponseTypes ESP8266OTABackend::begin(size_t image_size) {
|
||||
// NOLINTNEXTLINE(readability-static-accessed-through-instance)
|
||||
this->buffer_size_ = (ESP.getFreeHeap() > 2 * FLASH_SECTOR_SIZE) ? FLASH_SECTOR_SIZE : MIN_BUFFER_SIZE;
|
||||
|
||||
// ESP8266's umm_malloc guarantees 4-byte aligned allocations, which is required
|
||||
// for spi_flash_write(). This is the same pattern used by Arduino's Updater class.
|
||||
this->buffer_ = make_unique<uint8_t[]>(this->buffer_size_);
|
||||
if (!this->buffer_) {
|
||||
return OTA_RESPONSE_ERROR_UNKNOWN;
|
||||
|
||||
Reference in New Issue
Block a user