Commit e51a2db1 authored by David Faure's avatar David Faure
Browse files

Fix memory leaks in attributefactorytest

Test Plan: ctest -R attributefactorytest in an ASAN build

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: kde-pim

Differential Revision: https://phabricator.kde.org/D21122
parent c2c92eb9
......@@ -50,7 +50,11 @@ void AttributeFactoryTest::testUnknownAttribute()
item.setMimeType(QStringLiteral("text/directory"));
item.setPayload<QByteArray>("payload");
TestAttribute *ta = new TestAttribute;
QVERIFY(AttributeFactory::createAttribute(ta->type())); // DefaultAttribute
{
auto *created = AttributeFactory::createAttribute(ta->type()); // DefaultAttribute
QVERIFY(created != nullptr);
delete created;
}
ta->data = "lalala";
item.addAttribute(ta);
ItemCreateJob *cjob = new ItemCreateJob(item, res1);
......@@ -76,7 +80,11 @@ void AttributeFactoryTest::testRegisteredAttribute()
item.setMimeType(QStringLiteral("text/directory"));
item.setPayload<QByteArray>("payload");
TestAttribute *ta = new TestAttribute;
QVERIFY(AttributeFactory::createAttribute(ta->type()) != nullptr);
{
auto *created = AttributeFactory::createAttribute(ta->type());
QVERIFY(created != nullptr);
delete created;
}
ta->data = "lalala";
item.addAttribute(ta);
ItemCreateJob *cjob = new ItemCreateJob(item, res1);
......
Supports Markdown
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