From 67dea1e5389785f62b3f67ceb812af954217b283 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 26 Jan 2026 17:20:49 -1000 Subject: [PATCH] [light] Use member array instead of heap allocation in AddressableLightWrapper (#13503) --- esphome/components/light/addressable_light_wrapper.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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}; };