diff --git a/esphome/components/api/api_frame_helper.cpp b/esphome/components/api/api_frame_helper.cpp index e432a976b0..ca51ab49d8 100644 --- a/esphome/components/api/api_frame_helper.cpp +++ b/esphome/components/api/api_frame_helper.cpp @@ -134,7 +134,7 @@ void APIFrameHelper::buffer_data_from_iov_(const struct iovec *iov, int iovcnt, uint16_t buffer_size = total_write_len - offset; auto &buffer = this->tx_buf_[this->tx_buf_tail_]; buffer = std::make_unique(SendBuffer{ - .data = std::make_unique(buffer_size), + .data = std::make_unique_for_overwrite(buffer_size), .size = buffer_size, .offset = 0, });