Skip to content

Commit

Permalink
Fix memleaks found with AddressSanitizer/LeakSanitizer
Browse files Browse the repository at this point in the history
Found with:
ASAN_OPTIONS="detect_odr_violation=1,strip_path_prefix=$(pwd)/" build/sdrangel

Fixes:
Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f7b94ef46c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    f4exb#1 0x7f7b929ff74c in MainSettings::load() sdrbase/settings/mainsettings.cpp:153
    f4exb#2 0x7f7b947614f6 in MainWindow::loadSettings() sdrgui/mainwindow.cpp:1230
    f4exb#3 0x7f7b94759e11 in MainWindow::MainWindow(qtwebapp::LoggerWithFile*, MainParser const&, QWidget*) sdrgui/mainwindow.cpp:211
    f4exb#4 0x55b694e0a175 in runQtApplication app/main.cpp:196
    f4exb#5 0x55b694e07ab7 in main app/main.cpp:248
    f4exb#6 0x7f7b8f4456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 136 byte(s) in 1 object(s) allocated from:
    #0 0x7f7b94ef46c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    f4exb#1 0x7f7b929e734d in QList<Preset>::node_construct(QList<Preset>::Node*, Preset const&) /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:465
    f4exb#2 0x7f7b929e734d in QList<Preset>::append(Preset const&) /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:625
    f4exb#3 0x7f7b929e734d in QList<Preset>::push_back(Preset const&) /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:377
    f4exb#4 0x7f7b929e734d in Configuration::deserialize(QByteArray const&) sdrbase/settings/configuration.cpp:112
    f4exb#5 0x7f7b929ff934 in MainSettings::load() sdrbase/settings/mainsettings.cpp:155
    f4exb#6 0x7f7b947614f6 in MainWindow::loadSettings() sdrgui/mainwindow.cpp:1230
    f4exb#7 0x7f7b94759e11 in MainWindow::MainWindow(qtwebapp::LoggerWithFile*, MainParser const&, QWidget*) sdrgui/mainwindow.cpp:211
    f4exb#8 0x55b694e0a175 in runQtApplication app/main.cpp:196
    f4exb#9 0x55b694e07ab7 in main app/main.cpp:248
    f4exb#10 0x7f7b8f4456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f7b94ef46c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    f4exb#1 0x7f7b929e9706 in QList<Preset::DeviceConfig>::node_construct(QList<Preset::DeviceConfig>::Node*, Preset::DeviceConfig const&) /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:465
    f4exb#2 0x7f7b929e9706 in QList<Preset::DeviceConfig>::append(Preset::DeviceConfig const&) /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:625
    f4exb#3 0x7f7b929f627c in Preset::deserialize(QByteArray const&) sdrbase/settings/preset.cpp:193
    f4exb#4 0x7f7b929e74ca in Configuration::deserialize(QByteArray const&) sdrbase/settings/configuration.cpp:113
    f4exb#5 0x7f7b929ff934 in MainSettings::load() sdrbase/settings/mainsettings.cpp:155
    f4exb#6 0x7f7b947614f6 in MainWindow::loadSettings() sdrgui/mainwindow.cpp:1230
    f4exb#7 0x7f7b94759e11 in MainWindow::MainWindow(qtwebapp::LoggerWithFile*, MainParser const&, QWidget*) sdrgui/mainwindow.cpp:211
    f4exb#8 0x55b694e0a175 in runQtApplication app/main.cpp:196
    f4exb#9 0x55b694e07ab7 in main app/main.cpp:248
    f4exb#10 0x7f7b8f4456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
  • Loading branch information
dforsi committed Apr 6, 2024
1 parent 0b028aa commit d50f450
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdrbase/settings/mainsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ MainSettings::~MainSettings()
{
delete m_pluginPresets[i];
}

for (int i = 0; i < m_configurations.count(); ++i)
{
delete m_configurations[i];
}
}

QString MainSettings::getFileLocation() const
Expand Down

0 comments on commit d50f450

Please sign in to comment.