From 671438456ce9d66754fb459ac428a1411c066c05 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 4 May 2024 14:05:56 +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 32 byte(s) in 1 object(s) allocated from: #0 0x7f2360af46b8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95 #1 0x7f2321a07706 in AFC::MsgDeviceSetListsReport::create() sdrangel/plugins/feature/afc/afc.h:151 #2 0x7f2321a0ac1f in AFC::updateDeviceSetLists() sdrangel/plugins/feature/afc/afc.cpp:290 #3 0x7f2321a09648 in AFC::handleMessage(Message const&) sdrangel/plugins/feature/afc/afc.cpp:214 #4 0x7f235dfba569 in Feature::handleInputMessages() sdrangel/sdrbase/feature/feature.cpp:46 #5 0x7f235ddea09e in Feature::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) build-sdrangel-Desktop_qt5-Debug/sdrbase/sdrbase_autogen/3DM3QXXG3A/moc_feature.cpp:89 #6 0x7f235b305fcc (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x305fcc) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e) #7 0x7f235ddf5d8c in MessageQueue::messageEnqueued() build-sdrangel-Desktop_qt5-Debug/sdrbase/sdrbase_autogen/KH43KSYMFX/moc_messagequeue.cpp:131 #8 0x7f235e0e1487 in MessageQueue::push(Message*, bool) sdrangel/sdrbase/util/messagequeue.cpp:55 #9 0x7f2321a32fad in AFCGUI::requestDeviceSetLists() sdrangel/plugins/feature/afc/afcgui.cpp:213 #10 0x7f2321a32124 in AFCGUI::AFCGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) sdrangel/plugins/feature/afc/afcgui.cpp:170 #11 0x7f2321a308cc in AFCGUI::create(PluginAPI*, FeatureUISet*, Feature*) sdrangel/plugins/feature/afc/afcgui.cpp:32 #12 0x7f2321a1c229 in AFCPlugin::createFeatureGUI(FeatureUISet*, Feature*) const sdrangel/plugins/feature/afc/afcplugin.cpp:70 #13 0x7f235fffc534 in MainWindow::featureAddClicked(Workspace*, int) sdrangel/sdrgui/mainwindow.cpp:2890 #14 0x7f23600172c1 in QtPrivate::FunctorCall, QtPrivate::List, void, void (MainWindow::*)(Workspace*, int)>::call(void (MainWindow::*)(Workspace*, int), MainWindow*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152 #15 0x7f2360012b8d in void QtPrivate::FunctionPointer::call, void>(void (MainWindow::*)(Workspace*, int), MainWindow*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185 #16 0x7f2360010016 in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418 #17 0x7f235b3062b1 (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x3062b1) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e) #18 0x7f235ffcc7fc in Workspace::addFeature(Workspace*, int) build-sdrangel-Desktop_qt5-Debug/sdrgui/sdrgui_autogen/DMHXEJ42XS/moc_workspace.cpp:393 #19 0x7f23602f56f8 in Workspace::addFeatureEmitted(int) sdrangel/sdrgui/gui/workspace.cpp:413 #20 0x7f236030d611 in QtPrivate::FunctorCall, QtPrivate::List, void, void (Workspace::*)(int)>::call(void (Workspace::*)(int), Workspace*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152 #21 0x7f2360308bd9 in void QtPrivate::FunctionPointer::call, void>(void (Workspace::*)(int), Workspace*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185 #22 0x7f2360305cdc in QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418 #23 0x7f235b3062b1 (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x3062b1) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e) #24 0x7f235ffba7cf in FeatureAddDialog::addFeature(int) build-sdrangel-Desktop_qt5-Debug/sdrgui/sdrgui_autogen/DMHXEJ42XS/moc_featureadddialog.cpp:141 #25 0x7f23600c2d19 in FeatureAddDialog::apply(QAbstractButton*) sdrangel/sdrgui/gui/featureadddialog.cpp:53 #26 0x7f235ffba366 in FeatureAddDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) build-sdrangel-Desktop_qt5-Debug/sdrgui/sdrgui_autogen/DMHXEJ42XS/moc_featureadddialog.cpp:82 #27 0x7f235b305fcc (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x305fcc) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e) #28 0x7f235c1029b2 in QDialogButtonBox::clicked(QAbstractButton*) (/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x3029b2) (BuildId: dfefd27f084c0dd066215fc79825fceae604f481) --- plugins/feature/afc/afcgui.cpp | 1 + 1 file changed, 1 insertion(+) 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;