Commit 58f7885f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix mem leak found by ASAN

parent ee69e482
......@@ -63,7 +63,7 @@ void ShowOnlyMimePartTest::testDrawFrame()
QString referenceFileName(QStringLiteral(MAIL_DATA_DIR) + QLatin1Char('/') + commonName);
// load input mail
const KMime::Message::Ptr msg(Test::readAndParseMail(QStringLiteral("frametest.mbox")));
KMime::Message::Ptr msg(Test::readAndParseMail(QStringLiteral("frametest.mbox")));
// render the mail
FileHtmlWriter fileWriter(outFileName);
......@@ -85,6 +85,7 @@ void ShowOnlyMimePartTest::testDrawFrame()
fileWriter.end();
Test::compareFile(outFileName, referenceFileName);
msg.clear();
}
void ShowOnlyMimePartTest::testRelated_data()
......@@ -110,7 +111,7 @@ void ShowOnlyMimePartTest::testRelated()
QString referenceFileName(QStringLiteral(MAIL_DATA_DIR) + QLatin1Char('/') + commonName);
// load input mail
const KMime::Message::Ptr msg(Test::readAndParseMail(QStringLiteral("html-multipart-related.mbox")));
KMime::Message::Ptr msg(Test::readAndParseMail(QStringLiteral("html-multipart-related.mbox")));
// render the mail
FileHtmlWriter fileWriter(outFileName);
......@@ -132,6 +133,7 @@ void ShowOnlyMimePartTest::testRelated()
fileWriter.end();
Test::compareFile(outFileName, referenceFileName);
msg.clear();
}
QTEST_MAIN(ShowOnlyMimePartTest)
......@@ -80,6 +80,8 @@ void UnencryptedMessageTest::testNotDecrypted()
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
QCOMPARE((bool)unencryptedMessage, false);
originalMessage.clear();
unencryptedMessage.clear();
}
void UnencryptedMessageTest::testSMimeAutoCertImport()
......@@ -99,4 +101,5 @@ void UnencryptedMessageTest::testSMimeAutoCertImport()
QCOMPARE(otp.plainTextContent().toLatin1().data(), "");
QVERIFY(testWriter.data().contains("Sorry, certificate could not be imported."));
originalMessage.clear();
}
......@@ -374,7 +374,7 @@ void TemplateParserJobTest::test_forwardedAttachments()
QFile referenceFile(referenceFileName);
QVERIFY(referenceFile.open(QIODevice::ReadOnly));
const QByteArray referenceRawData = KMime::CRLFtoLF(referenceFile.readAll());
const KMime::Message::Ptr referenceMsg(new KMime::Message);
KMime::Message::Ptr referenceMsg(new KMime::Message);
referenceMsg->setContent(referenceRawData);
referenceMsg->parse();
......@@ -382,6 +382,7 @@ void TemplateParserJobTest::test_forwardedAttachments()
for (int i = 1; i < msg->contents().size(); i++) {
QCOMPARE(msg->contents()[i]->encodedContent(), referenceMsg->contents()[i]->encodedContent());
}
referenceMsg.clear();
} else {
QCOMPARE(msg->contents().size(), 0);
}
......
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