Browse Source

availablechannelorfeature : Initialize members

Initialize the indices and object pointer with safe default values so
default-constructed AvailableChannelOrFeature instances have defined state
before their members are accessed. This prevents undefined behavior from
using uninitialized data.

Found by cppcheck (uninitMemberVar).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 2 months ago
parent
commit
882256e966
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 8
      sdrbase/availablechannelorfeature.h

8
sdrbase/availablechannelorfeature.h

@ -27,11 +27,11 @@ @@ -27,11 +27,11 @@
struct SDRBASE_API AvailableChannelOrFeature
{
QChar m_kind; //!< 'R' or 'T' for channel, 'M' for MIMO channel, 'F' for feature as from MainCore::getDeviceSetTypeId
int m_superIndex; //!< Device Set index or Feature Set index
int m_index; //!< Channel or Feature index
int m_streamIndex; //!< For MIMO channels only
int m_superIndex = 0; //!< Device Set index or Feature Set index
int m_index = 0; //!< Channel or Feature index
int m_streamIndex = 0; //!< For MIMO channels only
QString m_type; //!< Plugin type (E.g. NFMDemod)
QObject *m_object; //!< Pointer to the object (ChannelAPI or Feature object)
QObject *m_object = nullptr; //!< Pointer to the object (ChannelAPI or Feature object)
AvailableChannelOrFeature() = default;
AvailableChannelOrFeature(const AvailableChannelOrFeature&) = default;

Loading…
Cancel
Save