From 5e5a5253f4c89a284d93f1d758327320b51711d0 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Mon, 22 Jul 2024 17:18:15 +0200 Subject: [PATCH] fix: initialize MQTT power meter values to zero avoid using uninitialized memory. --- src/PowerMeterMqtt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PowerMeterMqtt.cpp b/src/PowerMeterMqtt.cpp index fea0fea15..5789c9114 100644 --- a/src/PowerMeterMqtt.cpp +++ b/src/PowerMeterMqtt.cpp @@ -8,6 +8,7 @@ bool PowerMeterMqtt::init() { auto subscribe = [this](PowerMeterMqttValue const& val, float* targetVariable) { + *targetVariable = 0; char const* topic = val.Topic; if (strlen(topic) == 0) { return; } MqttSettings.subscribe(topic, 0,