From 3a10e38b1efe2963e2ab9eb8d44fecd4fab07f88 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:38:18 -0400 Subject: [PATCH] udpsource: Prevent unsafe copying of UDPSourceSource Explicitly delete the copy constructor and copy assignment operator for UDPSourceSource, which manages resources that should not be shared through implicit shallow copies. The implicitly generated copy operations could leave multiple UDPSourceSource instances referring to the same resources, potentially causing invalid ownership or double deletion. Since UDPSourceSource is not intended to be copied or assigned, prohibit both operations at compile time to prevent unsafe resource ownership. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- plugins/channeltx/udpsource/udpsourcesource.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/channeltx/udpsource/udpsourcesource.h b/plugins/channeltx/udpsource/udpsourcesource.h index 9fb6443b7..4f6f6c0d4 100644 --- a/plugins/channeltx/udpsource/udpsourcesource.h +++ b/plugins/channeltx/udpsource/udpsourcesource.h @@ -37,6 +37,8 @@ class UDPSourceSource : public ChannelSampleSource { public: UDPSourceSource(); virtual ~UDPSourceSource(); + UDPSourceSource(const UDPSourceSource&) = delete; + UDPSourceSource& operator=(const UDPSourceSource&) = delete; virtual void pull(SampleVector::iterator begin, unsigned int nbSamples); virtual void pullOne(Sample& sample);