From 6e8d1efb76c80ee3d57f900666288553ec8888ef Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:27:00 -0400 Subject: [PATCH] demoddatv/leansdr: Prevent unsafe copying of bch_engine Explicitly delete the copy constructor and copy assignment operator for bch_engine, which owns dynamically allocated arrays released by its destructor. The implicitly generated copy operations would shallow-copy the array pointers, leaving multiple bch_engine instances referring to the same allocations and potentially causing double deletion. Since bch_engine is not intended to be copied or assigned, prohibit both operations at compile time, preventing unsafe resource ownership. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/leansdr/bch.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/channelrx/demoddatv/leansdr/bch.h b/plugins/channelrx/demoddatv/leansdr/bch.h index 1b9cd38e9..afe136d0b 100644 --- a/plugins/channelrx/demoddatv/leansdr/bch.h +++ b/plugins/channelrx/demoddatv/leansdr/bch.h @@ -95,6 +95,8 @@ struct bch_engine : bch_interface delete[] truncpolys; delete[] syndpolys; } + bch_engine(const bch_engine&) = delete; + bch_engine& operator=(const bch_engine&) = delete; // Generate BCH parity bits.