Commit d9782419 authored by Milian Wolff's avatar Milian Wolff
Browse files

Don't leak QProcess in DebugSession::execInferior (remote debugging)

Fixes LSAN report:

```
Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7fbbce16ef41 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x56469f8deab5 in KDevMI::GDB::DebugSession::execInferior(KDevelop::ILaunchConfiguration*, IExecutePlugin*, QString const&) /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/plugins/gdb/debugsession.cpp:217
    #2 0x56469fa482f2 in KDevMI::MIDebugSession::startDebugging(KDevelop::ILaunchConfiguration*, IExecutePlugin*) /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/plugins/debuggercommon/midebugsession.cpp:284
    #3 0x56469f81ef97 in KDevMI::GDB::GdbTest::testRemoteDebug() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/plugins/gdb/unittests/test_gdb.cpp:1658
```
parent 5c55939f
......@@ -214,15 +214,13 @@ bool DebugSession::execInferior(KDevelop::ILaunchConfiguration *cfg, IExecutePlu
const auto tty = m_tty->getSlave();
const auto options = QString(QLatin1String(">") + tty + QLatin1String(" 2>&1 <") + tty);
auto *proc = new QProcess;
const QStringList arguments {
QStringLiteral("-c"),
KShell::quoteArg(runShellScript.toLocalFile()) + QLatin1Char(' ') + KShell::quoteArg(executable) + options,
};
qCDebug(DEBUGGERGDB) << "starting sh" << arguments;
proc->start(QStringLiteral("sh"), arguments);
//PORTING TODO QProcess::DontCare);
QProcess::startDetached(QStringLiteral("sh"), arguments);
}
if (runGdbScript.isValid()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment