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

Fix memory leak in TestMICommandQueue

Fixes LSAN report:
```
Indirect leak of 416 byte(s) in 4 object(s) allocated from:
    #0 0x7f28c3788f41 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55fa025c17a6 in TestMICommandQueue::addAndTake() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/plugins/debuggercommon/tests/test_micommandqueue.cpp:100
    #2 0x55fa025b8bc8 in TestMICommandQueue::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) plugins/debuggercommon/tests/test_micommandqueue_autogen/EWIEGA46WW/moc_test_micommandqueue.cpp:89
```
parent c85afb5a
......@@ -97,10 +97,10 @@ void TestMICommandQueue::addAndTake()
KDevMI::MI::CommandQueue commandQueue;
auto* command = new TestDummyCommand(KDevMI::MI::NonMI, QString(), flags);
auto command = std::make_unique<TestDummyCommand>(KDevMI::MI::NonMI, QString(), flags);
// add
commandQueue.enqueue(command);
commandQueue.enqueue(command.get());
// check
QVERIFY(command->token() != 0);
QCOMPARE(commandQueue.count(), 1);
......@@ -110,7 +110,7 @@ void TestMICommandQueue::addAndTake()
// take
auto* nextCommand = commandQueue.nextCommand();
// check
QCOMPARE(nextCommand, command);
QCOMPARE(nextCommand, command.get());
QVERIFY(nextCommand->token() != 0);
QCOMPARE(commandQueue.count(), 0);
QCOMPARE(commandQueue.isEmpty(), true);
......
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