From 5881aed035d310575e9394c8f1f24b0d04d20ca8 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:25:51 -0400 Subject: [PATCH] demodbfm: Prevent unsafe copying of BFMDemodSink Explicitly delete the copy constructor and copy assignment operator for BFMDemodSink, which manages resources that should not be shared through implicit shallow copies. The implicitly generated copy operations could leave multiple BFMDemodSink instances referring to the same resources, potentially causing invalid ownership or double deletion. Since BFMDemodSink 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/demodbfm/bfmdemodsink.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodbfm/bfmdemodsink.h b/plugins/channelrx/demodbfm/bfmdemodsink.h index a10ee7849..67b553609 100644 --- a/plugins/channelrx/demodbfm/bfmdemodsink.h +++ b/plugins/channelrx/demodbfm/bfmdemodsink.h @@ -44,7 +44,9 @@ class BasebandSampleSink; class BFMDemodSink : public ChannelSampleSink { public: BFMDemodSink(); - ~BFMDemodSink(); + ~BFMDemodSink(); + BFMDemodSink(const BFMDemodSink&) = delete; + BFMDemodSink& operator=(const BFMDemodSink&) = delete; virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);