From de131d1f6d91cc6cc4bc3aeb91b6a5064aec32c2 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Wed, 1 May 2024 15:40:01 +0200 Subject: [PATCH] Fix memleaks found with AddressSanitizer/LeakSanitizer Found with: ASAN_OPTIONS="detect_odr_violation=1,strip_path_prefix=$(pwd)/" build/sdrangel Fixes: Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x7efeb72f46b8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95 #1 0x7efe83515718 in WebServer::addSubstitution(QString, QString, QString) sdrangel/plugins/feature/map/webserver.cpp:84 #2 0x7efe83559c9e in MapGUI::applyMap3DSettings(bool) sdrangel/plugins/feature/map/mapgui.cpp:1789 #3 0x7efe8355e483 in MapGUI::displaySettings() sdrangel/plugins/feature/map/mapgui.cpp:1964 #4 0x7efe834be0f6 in MapGUI::MapGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) sdrangel/plugins/feature/map/mapgui.cpp:376 #5 0x7efe835372f4 in MapGUI::create(PluginAPI*, FeatureUISet*, Feature*) sdrangel/plugins/feature/map/mapgui.cpp:66 #6 0x7efe834b5471 in MapPlugin::createFeatureGUI(FeatureUISet*, Feature*) const sdrangel/plugins/feature/map/mapplugin.cpp:72 #7 0x7efeb6b416c2 in FeatureUISet::loadFeatureSetSettings(FeatureSetPreset const*, PluginAPI*, WebAPIAdapterInterface*, QList*, Workspace*) sdrangel/sdrgui/feature/featureuiset.cpp:185 #8 0x7efeb67e9b41 in MainWindow::loadConfiguration(Configuration const*, bool) sdrangel/sdrgui/mainwindow.cpp:1503 #9 0x7efeb6730e3e in MainWindow::MainWindow(qtwebapp::LoggerWithFile*, MainParser const&, QWidget*) sdrangel/sdrgui/mainwindow.cpp:257 #10 0x557281218bad in runQtApplication sdrangel/app/main.cpp:196 #11 0x5572812194a3 in main sdrangel/app/main.cpp:248 #12 0x7efeb10456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 --- plugins/feature/map/webserver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/feature/map/webserver.cpp b/plugins/feature/map/webserver.cpp index cb9116cd3..aa299cc28 100644 --- a/plugins/feature/map/webserver.cpp +++ b/plugins/feature/map/webserver.cpp @@ -44,6 +44,7 @@ WebServer::WebServer(quint16 &port, QObject* parent) : WebServer::~WebServer() { + qDeleteAll(m_substitutions); qDeleteAll(m_mimeTypes); }