From fe22e92c29b056b70bdfe02cdbf9cac210c325fd Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 1 Aug 2026 17:26:51 -0400 Subject: [PATCH] leansdr: Properly initialize QPSK hist buffer Replace raw memset() initialization of hist with C++ value initialization. This avoids bypassing std::complex object initialization and ensures the history buffer contains valid constructed objects when HIST_FLOAT is enabled. The previous memset() relied on the in-memory representation of std::complex and could leave non-trivial objects improperly initialized. While this typically behaved as expected with common implementations, it was not valid C++ object initialization. pointed out by cppcheck as: Using 'memset' on struct that contains a 'std::complex' Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/leansdr/sdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/channelrx/demoddatv/leansdr/sdr.h b/plugins/channelrx/demoddatv/leansdr/sdr.h index 42f555ee3..d35dcbd70 100644 --- a/plugins/channelrx/demoddatv/leansdr/sdr.h +++ b/plugins/channelrx/demoddatv/leansdr/sdr.h @@ -1472,6 +1472,7 @@ struct fast_qpsk_receiver : runnable meas_decimation(1048576), pll_adjustment(1.0), allow_drift(false), + hist{}, in(_in), out(_out, chunk_size), mu(0), @@ -1482,7 +1483,6 @@ struct fast_qpsk_receiver : runnable set_freq(0); freq_out = _freq_out ? new pipewriter(*_freq_out) : nullptr; cstln_out = _cstln_out ? new pipewriter>(*_cstln_out) : nullptr; - memset(hist, 0, sizeof(hist)); init_lookup_tables(); }