From 37d3765394faa57f5ce7412901ba11ce927c778d Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:25:15 -0400 Subject: [PATCH] demodatv: Prevent unsafe copying of ATVDemodSink Explicitly delete the copy constructor and copy assignment operator for ATVDemodSink, which manages dynamically allocated memory and other resources. The implicitly generated copy operations could shallow-copy owned resources, leaving multiple ATVDemodSink instances referring to the same resources and potentially causing invalid ownership or double deletion. Since ATVDemodSink is not intended to be copied or assigned, prohibit both operations at compile time, turning potential runtime errors into compile-time errors. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- plugins/channelrx/demodatv/atvdemodsink.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodatv/atvdemodsink.h b/plugins/channelrx/demodatv/atvdemodsink.h index b8bb4770e..911f51048 100644 --- a/plugins/channelrx/demodatv/atvdemodsink.h +++ b/plugins/channelrx/demodatv/atvdemodsink.h @@ -39,7 +39,9 @@ class ScopeVis; class ATVDemodSink : public ChannelSampleSink { public: ATVDemodSink(); - ~ATVDemodSink(); + ~ATVDemodSink(); + ATVDemodSink(const ATVDemodSink&) = delete; + ATVDemodSink& operator=(const ATVDemodSink&) = delete; virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);