diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index a2b33dd7b1..f68ad5a9f6 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -420,7 +420,7 @@ template::max()> if constexpr (std::is_trivially_copyable::value && std::is_trivially_default_constructible::value) { ::operator delete(this->data_); } else { - delete[] this->data_; + ::operator delete(this->data_); } } @@ -1804,7 +1804,7 @@ template class CallbackManager { public: CallbackManager() = default; - ~CallbackManager() { delete[] this->data_; } + ~CallbackManager() { ::operator delete(this->data_); } // Non-copyable (would alias data_), movable (for std::map support) CallbackManager(const CallbackManager &) = delete; @@ -1817,7 +1817,7 @@ template class CallbackManager { } CallbackManager &operator=(CallbackManager &&other) noexcept { if (this != &other) { - delete[] this->data_; + ::operator delete(this->data_); this->data_ = other.data_; this->size_ = other.size_; this->capacity_ = other.capacity_;