From 37de782e3ef8c1fb635e6a5adc725e60a5443e39 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 26 Dec 2025 22:13:10 -1000 Subject: [PATCH] guard --- esphome/components/ota/ota_backend_esp8266.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/ota/ota_backend_esp8266.cpp b/esphome/components/ota/ota_backend_esp8266.cpp index 38e9d214b26..fe829ab0629 100644 --- a/esphome/components/ota/ota_backend_esp8266.cpp +++ b/esphome/components/ota/ota_backend_esp8266.cpp @@ -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(this->buffer_size_); if (!this->buffer_) { return OTA_RESPONSE_ERROR_UNKNOWN;