Just build Konsole with -DECM_ENABLE_SANITIZERS=address, and then run and exit Konsole to reproduce. Indirect leak of 112 byte(s) in 1 object(s) allocated from: #0 0x7f516ac71ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7f5168713f64 in QRegularExpressionValidator::QRegularExpressionValidator(QObject*) (/usr/lib/libQt5Gui.so.5+0x4a3f64) #2 0x7ffc806d906f ([stack]+0x1e06f) Indirect leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7f516ac71ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7f5168713525 in QValidator::QValidator(QObject*) (/usr/lib/libQt5Gui.so.5+0x4a3525) #2 0x7f516009c8ec in SSHManagerPlugin::createWidgetsForMainWindow(Konsole::MainWindow*) ../src/plugins/SSHManager/sshmanagerplugin.cpp:47 #3 0x7f516ab17629 in Konsole::IKonsolePlugin::addMainWindow(Konsole::MainWindow*) ../src/pluginsystem/IKonsolePlugin.cpp:40 #4 0x7f516ab19ab7 in Konsole::PluginManager::registerMainWindow(Konsole::MainWindow*) ../src/pluginsystem/PluginManager.cpp:57 #5 0x7f516aaa8208 in Konsole::Application::newMainWindow() ../src/Application.cpp:170 #6 0x7f516aaae2c5 in Konsole::Application::processWindowArgs(bool&) ../src/Application.cpp:428 #7 0x7f516aaa91e4 in Konsole::Application::newInstance() ../src/Application.cpp:214 #8 0x564b716a75d2 in main ../src/main.cpp:204 #9 0x7f5167752b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f516ac71ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7f5167dd8dc6 in QRegularExpression::QRegularExpression(QString const&, QFlags<QRegularExpression::PatternOption>) (/usr/lib/libQt5Core.so.5+0x16cdc6) Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f516ac71ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7f5167ddd157 (/usr/lib/libQt5Core.so.5+0x171157) Indirect leak of 24 byte(s) in 1 object(s) allocated from: #0 0x7f516ac71ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7f51600a4da3 in SSHManagerTreeWidget::SSHManagerTreeWidget(QWidget*) ../src/plugins/SSHManager/sshmanagerpluginwidget.cpp:57 #2 0x7f516009c8ec in SSHManagerPlugin::createWidgetsForMainWindow(Konsole::MainWindow*) ../src/plugins/SSHManager/sshmanagerplugin.cpp:47 #3 0x7f516ab17629 in Konsole::IKonsolePlugin::addMainWindow(Konsole::MainWindow*) ../src/pluginsystem/IKonsolePlugin.cpp:40 #4 0x7f516ab19ab7 in Konsole::PluginManager::registerMainWindow(Konsole::MainWindow*) ../src/pluginsystem/PluginManager.cpp:57 #5 0x7f516aaa8208 in Konsole::Application::newMainWindow() ../src/Application.cpp:170 #6 0x7f516aaae2c5 in Konsole::Application::processWindowArgs(bool&) ../src/Application.cpp:428 #7 0x7f516aaa91e4 in Konsole::Application::newInstance() ../src/Application.cpp:214 #8 0x564b716a75d2 in main ../src/main.cpp:204 #9 0x7f5167752b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) Indirect leak of 16 byte(s) in 1 object(s) allocated from: #0 0x7f516ac71ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 #1 0x7f51600a4d29 in SSHManagerTreeWidget::SSHManagerTreeWidget(QWidget*) ../src/plugins/SSHManager/sshmanagerpluginwidget.cpp:54 #2 0x7f516009c8ec in SSHManagerPlugin::createWidgetsForMainWindow(Konsole::MainWindow*) ../src/plugins/SSHManager/sshmanagerplugin.cpp:47 #3 0x7f516ab17629 in Konsole::IKonsolePlugin::addMainWindow(Konsole::MainWindow*) ../src/pluginsystem/IKonsolePlugin.cpp:40 #4 0x7f516ab19ab7 in Konsole::PluginManager::registerMainWindow(Konsole::MainWindow*) ../src/pluginsystem/PluginManager.cpp:57 #5 0x7f516aaa8208 in Konsole::Application::newMainWindow() ../src/Application.cpp:170 #6 0x7f516aaae2c5 in Konsole::Application::processWindowArgs(bool&) ../src/Application.cpp:428 #7 0x7f516aaa91e4 in Konsole::Application::newInstance() ../src/Application.cpp:214 #8 0x564b716a75d2 in main ../src/main.cpp:204 #9 0x7f5167752b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
Created attachment 139898 [details] attachment-12067-0.html Looking at it On Tue, 6 Jul 2021 at 13:35 Martin Sandsmark <bugzilla_noreply@kde.org> wrote: > https://bugs.kde.org/show_bug.cgi?id=439555 > > Bug ID: 439555 > Summary: Memory leak in SSH manager. > Product: konsole > Version: master > Platform: Other > OS: Linux > Status: REPORTED > Severity: normal > Priority: NOR > Component: general > Assignee: konsole-devel@kde.org > Reporter: martin.sandsmark@kde.org > Target Milestone: --- > > Just build Konsole with -DECM_ENABLE_SANITIZERS=address, and then run and > exit > Konsole to reproduce. > > > Indirect leak of 112 byte(s) in 1 object(s) allocated from: > #0 0x7f516ac71ca1 in operator new(unsigned long) > /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 > #1 0x7f5168713f64 in > QRegularExpressionValidator::QRegularExpressionValidator(QObject*) > (/usr/lib/libQt5Gui.so.5+0x4a3f64) > #2 0x7ffc806d906f ([stack]+0x1e06f) > > Indirect leak of 96 byte(s) in 1 object(s) allocated from: > #0 0x7f516ac71ca1 in operator new(unsigned long) > /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 > #1 0x7f5168713525 in QValidator::QValidator(QObject*) > (/usr/lib/libQt5Gui.so.5+0x4a3525) > #2 0x7f516009c8ec in > SSHManagerPlugin::createWidgetsForMainWindow(Konsole::MainWindow*) > ../src/plugins/SSHManager/sshmanagerplugin.cpp:47 > #3 0x7f516ab17629 in > Konsole::IKonsolePlugin::addMainWindow(Konsole::MainWindow*) > ../src/pluginsystem/IKonsolePlugin.cpp:40 > #4 0x7f516ab19ab7 in > Konsole::PluginManager::registerMainWindow(Konsole::MainWindow*) > ../src/pluginsystem/PluginManager.cpp:57 > #5 0x7f516aaa8208 in Konsole::Application::newMainWindow() > ../src/Application.cpp:170 > #6 0x7f516aaae2c5 in Konsole::Application::processWindowArgs(bool&) > ../src/Application.cpp:428 > #7 0x7f516aaa91e4 in Konsole::Application::newInstance() > ../src/Application.cpp:214 > #8 0x564b716a75d2 in main ../src/main.cpp:204 > #9 0x7f5167752b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) > > Indirect leak of 48 byte(s) in 1 object(s) allocated from: > #0 0x7f516ac71ca1 in operator new(unsigned long) > /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 > #1 0x7f5167dd8dc6 in QRegularExpression::QRegularExpression(QString > const&, > QFlags<QRegularExpression::PatternOption>) > (/usr/lib/libQt5Core.so.5+0x16cdc6) > > Indirect leak of 48 byte(s) in 1 object(s) allocated from: > #0 0x7f516ac71ca1 in operator new(unsigned long) > /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 > #1 0x7f5167ddd157 (/usr/lib/libQt5Core.so.5+0x171157) > > Indirect leak of 24 byte(s) in 1 object(s) allocated from: > #0 0x7f516ac71ca1 in operator new(unsigned long) > /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 > #1 0x7f51600a4da3 in > SSHManagerTreeWidget::SSHManagerTreeWidget(QWidget*) > ../src/plugins/SSHManager/sshmanagerpluginwidget.cpp:57 > #2 0x7f516009c8ec in > SSHManagerPlugin::createWidgetsForMainWindow(Konsole::MainWindow*) > ../src/plugins/SSHManager/sshmanagerplugin.cpp:47 > #3 0x7f516ab17629 in > Konsole::IKonsolePlugin::addMainWindow(Konsole::MainWindow*) > ../src/pluginsystem/IKonsolePlugin.cpp:40 > #4 0x7f516ab19ab7 in > Konsole::PluginManager::registerMainWindow(Konsole::MainWindow*) > ../src/pluginsystem/PluginManager.cpp:57 > #5 0x7f516aaa8208 in Konsole::Application::newMainWindow() > ../src/Application.cpp:170 > #6 0x7f516aaae2c5 in Konsole::Application::processWindowArgs(bool&) > ../src/Application.cpp:428 > #7 0x7f516aaa91e4 in Konsole::Application::newInstance() > ../src/Application.cpp:214 > #8 0x564b716a75d2 in main ../src/main.cpp:204 > #9 0x7f5167752b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) > > Indirect leak of 16 byte(s) in 1 object(s) allocated from: > #0 0x7f516ac71ca1 in operator new(unsigned long) > /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99 > #1 0x7f51600a4d29 in > SSHManagerTreeWidget::SSHManagerTreeWidget(QWidget*) > ../src/plugins/SSHManager/sshmanagerpluginwidget.cpp:54 > #2 0x7f516009c8ec in > SSHManagerPlugin::createWidgetsForMainWindow(Konsole::MainWindow*) > ../src/plugins/SSHManager/sshmanagerplugin.cpp:47 > #3 0x7f516ab17629 in > Konsole::IKonsolePlugin::addMainWindow(Konsole::MainWindow*) > ../src/pluginsystem/IKonsolePlugin.cpp:40 > #4 0x7f516ab19ab7 in > Konsole::PluginManager::registerMainWindow(Konsole::MainWindow*) > ../src/pluginsystem/PluginManager.cpp:57 > #5 0x7f516aaa8208 in Konsole::Application::newMainWindow() > ../src/Application.cpp:170 > #6 0x7f516aaae2c5 in Konsole::Application::processWindowArgs(bool&) > ../src/Application.cpp:428 > #7 0x7f516aaa91e4 in Konsole::Application::newInstance() > ../src/Application.cpp:214 > #8 0x564b716a75d2 in main ../src/main.cpp:204 > #9 0x7f5167752b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) > > -- > You are receiving this mail because: > You are the assignee for the bug.
Just looking at the code, the thing leaked is the QRegularExpressionValidator. So this I think should be enough, but I haven't had time to test: diff --git src/plugins/SSHManager/sshmanagerpluginwidget.cpp src/plugins/SSHManager/sshmanagerpluginwidget.cpp index bd2f1539..7ba52b64 100644 --- src/plugins/SSHManager/sshmanagerpluginwidget.cpp +++ src/plugins/SSHManager/sshmanagerpluginwidget.cpp @@ -51,7 +51,7 @@ d(std::make_unique<SSHManagerTreeWidget::Private>()) QStringLiteral(R"(^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$)") ); - const auto* hostnameValidator = new QRegularExpressionValidator(hostnameRegex); + const auto* hostnameValidator = new QRegularExpressionValidator(hostnameRegex, this); ui->hostname->setValidator(hostnameValidator); const auto* portValidator = new QIntValidator(0, 9999);
Git commit 2f1450d80c94c2034da568614b0f430891870216 by Kurt Hindenburg. Committed on 09/07/2021 at 15:40. Pushed by hindenburg into branch 'master'. Fix memory link in ssh manager QRegularExpressionValidator() Patch by Martin T. H. Sandsmark <martin.sandsmark@kde.org> M +1 -1 src/plugins/SSHManager/sshmanagerpluginwidget.cpp https://invent.kde.org/utilities/konsole/commit/2f1450d80c94c2034da568614b0f430891870216
Thanks verified your patch works - appears there are a few other leaks