From ecf16afde61c5392f8c9aaee2d02482a6757e249 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:24:41 -0400 Subject: [PATCH] demodam: Prevent unsafe copying of AMDemodSink Explicitly delete the copy constructor and copy assignment operator for AMDemodSink, which manages dynamically allocated memory and other resources. The implicitly generated copy operations could shallow-copy owned resources, leaving multiple AMDemodSink instances referring to the same resources and potentially causing invalid ownership or double deletion. Since AMDemodSink 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/demodam/amdemodsink.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodam/amdemodsink.h b/plugins/channelrx/demodam/amdemodsink.h index bc575ec3d..d1e1db192 100644 --- a/plugins/channelrx/demodam/amdemodsink.h +++ b/plugins/channelrx/demodam/amdemodsink.h @@ -38,7 +38,10 @@ class ChannelAPI; class AMDemodSink : public ChannelSampleSink { public: AMDemodSink(); - ~AMDemodSink(); + ~AMDemodSink(); + AMDemodSink(const AMDemodSink&) = delete; + AMDemodSink& operator=(const AMDemodSink&) = delete; + virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);