Browse Source

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 <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 1 month ago
parent
commit
ecf16afde6
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 5
      plugins/channelrx/demodam/amdemodsink.h

5
plugins/channelrx/demodam/amdemodsink.h

@ -38,7 +38,10 @@ class ChannelAPI; @@ -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);

Loading…
Cancel
Save