From 6de22b6d258611c0bf3bad82bca0c110ccbc4a2d Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Fri, 22 Aug 2025 12:58:59 +0100 Subject: [PATCH] Add delete/nullptr check to begin (dtor not called) --- .../i2c/drivers/WipperSnapper_I2C_Driver_MLX90632D.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_MLX90632D.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_MLX90632D.h index 4140f44b..911e8edc 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_MLX90632D.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_MLX90632D.h @@ -65,6 +65,10 @@ class WipperSnapper_I2C_Driver_MLX90632D : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool begin() { + if (_mlx90632) { + delete _mlx90632; + _mlx90632 = nullptr; + } _mlx90632 = new Adafruit_MLX90632(); // attempt to initialize MLX90632 if (!_mlx90632->begin(_sensorAddress, _i2c)) return false;