From a30de71fa1e347531121cb893253e21bc1de3447 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:29:51 -0400 Subject: [PATCH] demoddatv/leansdr: Prevent unsafe copying of pipebuf Explicitly delete the copy constructor and copy assignment operator for pipebuf, which owns a dynamically allocated buffer released by its destructor. The implicitly generated copy operations would shallow-copy the buffer pointer, leaving multiple pipebuf instances referring to the same allocation and potentially causing double deletion. Since pipebuf 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/channelrx/demoddatv/leansdr/framework.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/channelrx/demoddatv/leansdr/framework.h b/plugins/channelrx/demoddatv/leansdr/framework.h index e76965359..68dbbeb58 100644 --- a/plugins/channelrx/demoddatv/leansdr/framework.h +++ b/plugins/channelrx/demoddatv/leansdr/framework.h @@ -248,6 +248,9 @@ struct pipebuf : pipebuf_common delete[] buf; } + pipebuf(const pipebuf&) = delete; + pipebuf& operator=(const pipebuf&) = delete; + int sizeofT() { return sizeof(T); }