diff --git a/esphome/components/light/addressable_light_wrapper.h b/esphome/components/light/addressable_light_wrapper.h index 8665e62a79..cd83482248 100644 --- a/esphome/components/light/addressable_light_wrapper.h +++ b/esphome/components/light/addressable_light_wrapper.h @@ -7,9 +7,7 @@ namespace esphome::light { class AddressableLightWrapper : public light::AddressableLight { public: - explicit AddressableLightWrapper(light::LightState *light_state) : light_state_(light_state) { - this->wrapper_state_ = new uint8_t[5]; // NOLINT(cppcoreguidelines-owning-memory) - } + explicit AddressableLightWrapper(light::LightState *light_state) : light_state_(light_state) {} int32_t size() const override { return 1; } @@ -118,7 +116,7 @@ class AddressableLightWrapper : public light::AddressableLight { } light::LightState *light_state_; - uint8_t *wrapper_state_; + mutable uint8_t wrapper_state_[5]{}; ColorMode color_mode_{ColorMode::UNKNOWN}; };