diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe3b62b2d2..cd74fddff5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,8 @@ set(sdrangel_VERSION_SUFFIX "")
# SDRAngel cmake options
option(DEBUG_OUTPUT "Print debug messages" OFF)
-option(SANITIZE_ADDRESS "Activate memory address sanitization" OFF)
+option(SANITIZE_ADDRESS "Activate detection of uninitialized memory (AddressSanitizer)" OFF)
+option(SANITIZE_MEMORY "Activate detection of leaked memory (LeakSanitizer)" OFF)
option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" ON)
option(BUILD_SERVER "Build Server" ON)
option(BUILD_GUI "Build GUI" ON)
diff --git a/plugins/feature/afc/afcgui.cpp b/plugins/feature/afc/afcgui.cpp
index 0108852f04..e855d605cb 100644
--- a/plugins/feature/afc/afcgui.cpp
+++ b/plugins/feature/afc/afcgui.cpp
@@ -103,6 +103,7 @@ bool AFCGUI::handleMessage(const Message& message)
{
const AFC::MsgDeviceSetListsReport& report = (AFC::MsgDeviceSetListsReport&) message;
updateDeviceSetLists(report);
+ return true;
}
return false;
diff --git a/plugins/feature/gs232controller/gs232controller.cpp b/plugins/feature/gs232controller/gs232controller.cpp
index 27e02c5b6c..52a2298c34 100644
--- a/plugins/feature/gs232controller/gs232controller.cpp
+++ b/plugins/feature/gs232controller/gs232controller.cpp
@@ -288,11 +288,10 @@ void GS232Controller::applySettings(const GS232ControllerSettings& settings, con
m_selectedPipe = m_availableChannelOrFeatureHandler.registerPipes(settings.m_source, {"target"});
}
- GS232ControllerWorker::MsgConfigureGS232ControllerWorker *msg = GS232ControllerWorker::MsgConfigureGS232ControllerWorker::create(
- settings, settingsKeys, force
- );
-
if (m_worker) {
+ GS232ControllerWorker::MsgConfigureGS232ControllerWorker *msg = GS232ControllerWorker::MsgConfigureGS232ControllerWorker::create(
+ settings, settingsKeys, force
+ );
m_worker->getInputMessageQueue()->push(msg);
}
diff --git a/plugins/feature/map/webserver.cpp b/plugins/feature/map/webserver.cpp
index 3a2eb29240..aa299cc283 100644
--- a/plugins/feature/map/webserver.cpp
+++ b/plugins/feature/map/webserver.cpp
@@ -15,6 +15,7 @@
// along with this program. If not, see . //
///////////////////////////////////////////////////////////////////////////////////
+#include
#include
#include
#include
@@ -41,6 +42,12 @@ WebServer::WebServer(quint16 &port, QObject* parent) :
m_mimeTypes.insert(".geojson", new MimeType("application/geo+json"));
}
+WebServer::~WebServer()
+{
+ qDeleteAll(m_substitutions);
+ qDeleteAll(m_mimeTypes);
+}
+
void WebServer::incomingConnection(qintptr socket)
{
QTcpSocket* s = new QTcpSocket(this);
diff --git a/plugins/feature/map/webserver.h b/plugins/feature/map/webserver.h
index 7aa5070da0..b24f92ba42 100644
--- a/plugins/feature/map/webserver.h
+++ b/plugins/feature/map/webserver.h
@@ -64,6 +64,7 @@ class WebServer : public QTcpServer
public:
WebServer(quint16 &port, QObject* parent = 0);
+ ~WebServer();
void incomingConnection(qintptr socket) override;
void addPathSubstitution(const QString &from, const QString &to);
void addSubstitution(QString path, QString from, QString to);
diff --git a/plugins/feature/pertester/pertester.cpp b/plugins/feature/pertester/pertester.cpp
index 6b4b422a67..6a5316b07d 100644
--- a/plugins/feature/pertester/pertester.cpp
+++ b/plugins/feature/pertester/pertester.cpp
@@ -189,10 +189,10 @@ void PERTester::applySettings(const PERTesterSettings& settings, const QListgetInputMessageQueue()->push(msg);
}
diff --git a/plugins/feature/satellitetracker/satellitetracker.cpp b/plugins/feature/satellitetracker/satellitetracker.cpp
index e64b6a848c..ce8540dd14 100644
--- a/plugins/feature/satellitetracker/satellitetracker.cpp
+++ b/plugins/feature/satellitetracker/satellitetracker.cpp
@@ -208,11 +208,10 @@ void SatelliteTracker::applySettings(const SatelliteTrackerSettings& settings, c
tlesChanged = true;
}
- SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker *msg = SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker::create(
- settings, settingsKeys, force
- );
-
if (m_worker) {
+ SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker *msg = SatelliteTrackerWorker::MsgConfigureSatelliteTrackerWorker::create(
+ settings, settingsKeys, force
+ );
m_worker->getInputMessageQueue()->push(msg);
}
diff --git a/plugins/feature/skymap/webserver.cpp b/plugins/feature/skymap/webserver.cpp
index 23dc85e7be..8de3099e6e 100644
--- a/plugins/feature/skymap/webserver.cpp
+++ b/plugins/feature/skymap/webserver.cpp
@@ -41,6 +41,12 @@ WebServer::WebServer(quint16 &port, QObject* parent) :
m_mimeTypes.insert(".geojson", new MimeType("application/geo+json"));
}
+WebServer::~WebServer()
+{
+ qDeleteAll(m_substitutions);
+ qDeleteAll(m_mimeTypes);
+}
+
void WebServer::incomingConnection(qintptr socket)
{
QTcpSocket* s = new QTcpSocket(this);
diff --git a/plugins/feature/skymap/webserver.h b/plugins/feature/skymap/webserver.h
index da3e034b3d..292078e352 100644
--- a/plugins/feature/skymap/webserver.h
+++ b/plugins/feature/skymap/webserver.h
@@ -64,6 +64,7 @@ class WebServer : public QTcpServer
public:
WebServer(quint16 &port, QObject* parent = 0);
+ ~WebServer();
void incomingConnection(qintptr socket) override;
void addPathSubstitution(const QString &from, const QString &to);
void addSubstitution(QString path, QString from, QString to);
diff --git a/plugins/feature/startracker/startracker.cpp b/plugins/feature/startracker/startracker.cpp
index c656cb2b05..2f2b258d45 100644
--- a/plugins/feature/startracker/startracker.cpp
+++ b/plugins/feature/startracker/startracker.cpp
@@ -163,25 +163,25 @@ bool StarTracker::handleMessage(const Message& cmd)
}
else if (MsgSetSolarFlux::match(cmd))
{
- MsgSetSolarFlux& msg = (MsgSetSolarFlux&) cmd;
- m_solarFlux = msg.getFlux();
if (m_worker) {
+ MsgSetSolarFlux& msg = (MsgSetSolarFlux&) cmd;
+ m_solarFlux = msg.getFlux();
m_worker->getInputMessageQueue()->push(new MsgSetSolarFlux(msg));
}
return true;
}
else if (MainCore::MsgStarTrackerDisplaySettings::match(cmd))
{
- MainCore::MsgStarTrackerDisplaySettings& settings = (MainCore::MsgStarTrackerDisplaySettings&) cmd;
if (m_guiMessageQueue) {
+ MainCore::MsgStarTrackerDisplaySettings& settings = (MainCore::MsgStarTrackerDisplaySettings&) cmd;
m_guiMessageQueue->push(new MainCore::MsgStarTrackerDisplaySettings(settings));
}
return true;
}
else if (MainCore::MsgStarTrackerDisplayLoSSettings::match(cmd))
{
- MainCore::MsgStarTrackerDisplayLoSSettings& settings = (MainCore::MsgStarTrackerDisplayLoSSettings&) cmd;
if (m_guiMessageQueue) {
+ MainCore::MsgStarTrackerDisplayLoSSettings& settings = (MainCore::MsgStarTrackerDisplayLoSSettings&) cmd;
m_guiMessageQueue->push(new MainCore::MsgStarTrackerDisplayLoSSettings(settings));
}
return true;
@@ -246,10 +246,10 @@ void StarTracker::applySettings(const StarTrackerSettings& settings, const QList
}
}
- StarTrackerWorker::MsgConfigureStarTrackerWorker *msg = StarTrackerWorker::MsgConfigureStarTrackerWorker::create(
- settings, settingsKeys, force
- );
if (m_worker) {
+ StarTrackerWorker::MsgConfigureStarTrackerWorker *msg = StarTrackerWorker::MsgConfigureStarTrackerWorker::create(
+ settings, settingsKeys, force
+ );
m_worker->getInputMessageQueue()->push(msg);
}
diff --git a/sdrbase/device/deviceuserargs.cpp b/sdrbase/device/deviceuserargs.cpp
index aae94111f8..384abe7611 100644
--- a/sdrbase/device/deviceuserargs.cpp
+++ b/sdrbase/device/deviceuserargs.cpp
@@ -40,8 +40,8 @@ QByteArray DeviceUserArgs::serialize() const
{
SimpleSerializer s(1);
QByteArray data;
- QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
- *stream << m_argsByDevice;
+ QDataStream stream(&data, QIODevice::WriteOnly);
+ stream << m_argsByDevice;
s.writeBlob(1, data);
return s.final();
}
diff --git a/sdrbase/maincore.cpp b/sdrbase/maincore.cpp
index ac5c74066e..e6070aedb6 100644
--- a/sdrbase/maincore.cpp
+++ b/sdrbase/maincore.cpp
@@ -209,6 +209,7 @@ void MainCore::removeLastFeatureSet()
FeatureSet *featureSet = m_featureSets.back();
m_featureSetsMap.remove(featureSet);
m_featureSets.pop_back();
+ delete featureSet;
}
}
@@ -227,6 +228,7 @@ void MainCore::removeLastDeviceSet()
DeviceSet *deviceSet = m_deviceSets.back();
m_deviceSetsMap.remove(deviceSet);
m_deviceSets.pop_back();
+ delete deviceSet;
}
}
diff --git a/sdrbase/settings/mainsettings.cpp b/sdrbase/settings/mainsettings.cpp
index b2ea29bbcd..fbf8bf1b6d 100644
--- a/sdrbase/settings/mainsettings.cpp
+++ b/sdrbase/settings/mainsettings.cpp
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see . //
///////////////////////////////////////////////////////////////////////////////////////
+#include
#include
#include
#include
@@ -34,24 +35,11 @@ MainSettings::MainSettings() :
MainSettings::~MainSettings()
{
- for (int i = 0; i < m_presets.count(); ++i)
- {
- delete m_presets[i];
- }
-
- for (int i = 0; i < m_commands.count(); ++i)
- {
- delete m_commands[i];
- }
-
- for (int i = 0; i < m_featureSetPresets.count(); ++i)
- {
- delete m_featureSetPresets[i];
- }
- for (int i = 0; i < m_pluginPresets.count(); ++i)
- {
- delete m_pluginPresets[i];
- }
+ qDeleteAll(m_presets);
+ qDeleteAll(m_commands);
+ qDeleteAll(m_featureSetPresets);
+ qDeleteAll(m_pluginPresets);
+ qDeleteAll(m_configurations);
}
QString MainSettings::getFileLocation() const
diff --git a/sdrbase/util/airlines.cpp b/sdrbase/util/airlines.cpp
index 75fe7fc163..1a3f3dd2f5 100644
--- a/sdrbase/util/airlines.cpp
+++ b/sdrbase/util/airlines.cpp
@@ -5560,3 +5560,8 @@ Airline::Init::Init()
s += 4;
}
}
+
+Airline::Init::~Init()
+{
+ qDeleteAll(m_icaoHash);
+}
diff --git a/sdrbase/util/airlines.h b/sdrbase/util/airlines.h
index 7eed494f89..34ac5890bf 100644
--- a/sdrbase/util/airlines.h
+++ b/sdrbase/util/airlines.h
@@ -55,6 +55,7 @@ class SDRBASE_API Airline {
friend struct Init;
struct Init {
Init();
+ ~Init();
static const char *m_airlines[];
};
static Init m_init;
diff --git a/sdrgui/gui/glshaderspectrogram.cpp b/sdrgui/gui/glshaderspectrogram.cpp
index 8fd07b3c04..a46f5fb053 100644
--- a/sdrgui/gui/glshaderspectrogram.cpp
+++ b/sdrgui/gui/glshaderspectrogram.cpp
@@ -514,6 +514,8 @@ void GLShaderSpectrogram::drawSurface(SpectrumSettings::SpectrogramStyle style,
void GLShaderSpectrogram::cleanup()
{
+ delete m_vao;
+ m_vao = nullptr;
delete m_programShaded;
m_programShaded = nullptr;
delete m_programSimple;