Commit bbe60ed9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix mem leak found by asan

parent 9c18849b
Pipeline #24795 passed with stage
in 38 minutes and 4 seconds
......@@ -72,6 +72,7 @@ void AttachmentJobTest::testAttachment()
QCOMPARE(result->body(), data);
QVERIFY(result->contentDisposition(false)->disposition() == Headers::CDattachment);
delete result;
delete composer;
}
#if 0
......
......@@ -69,6 +69,8 @@ void MainTextJobTest::testPlainText()
QCOMPARE(result->contentType()->mimeType(), QByteArray("text/plain"));
QCOMPARE(result->contentType()->charset(), QByteArray("us-ascii"));
QCOMPARE(QString::fromLatin1(result->body()), data);
delete textPart;
delete composer;
}
void MainTextJobTest::testWrappingErrors()
......@@ -84,6 +86,8 @@ void MainTextJobTest::testWrappingErrors()
MainTextJob *mjob = new MainTextJob(textPart, composer);
QVERIFY(!mjob->exec()); // error: not UseWrapping but given only wrapped text
QCOMPARE(mjob->error(), int(JobBase::BugError));
delete textPart;
delete composer;
}
{
Composer *composer = new Composer;
......@@ -96,6 +100,8 @@ void MainTextJobTest::testWrappingErrors()
MainTextJob *mjob = new MainTextJob(textPart, composer);
QVERIFY(!mjob->exec()); // error: UseWrapping but given only clean text
QCOMPARE(mjob->error(), int(JobBase::BugError));
delete textPart;
delete composer;
}
}
......@@ -120,6 +126,8 @@ void MainTextJobTest::testCustomCharset()
QTextCodec *codec = QTextCodec::codecForName(charset);
QVERIFY(codec);
QCOMPARE(codec->toUnicode(outData), data);
delete textPart;
delete composer;
}
void MainTextJobTest::testNoCharset()
......@@ -135,6 +143,8 @@ void MainTextJobTest::testNoCharset()
QVERIFY(!mjob->exec()); // Error.
QCOMPARE(mjob->error(), int(JobBase::BugError));
qDebug() << mjob->errorString();
delete textPart;
delete composer;
}
void MainTextJobTest::testBadCharset()
......@@ -151,6 +161,8 @@ void MainTextJobTest::testBadCharset()
QVERIFY(!mjob->exec()); // Error.
QCOMPARE(mjob->error(), int(JobBase::UserError));
qDebug() << mjob->errorString();
delete textPart;
delete composer;
}
void MainTextJobTest::testFallbackCharset()
......@@ -170,6 +182,8 @@ void MainTextJobTest::testFallbackCharset()
QCOMPARE(result->contentType()->mimeType(), QByteArray("text/plain"));
QCOMPARE(result->contentType()->charset(), QByteArray("us-ascii")); // Fallback is us-ascii or utf8.
QCOMPARE(QString::fromLatin1(result->body()), data);
delete textPart;
delete composer;
}
void MainTextJobTest::testHtml()
......@@ -214,6 +228,7 @@ void MainTextJobTest::testHtml()
QCOMPARE(QLatin1String(html->body()), editor.toCleanHtml());
}
}
delete composer;
}
void MainTextJobTest::testHtmlWithImages()
......@@ -309,4 +324,6 @@ void MainTextJobTest::testHtmlWithImages()
QCOMPARE(cid->identifier(), cid2.toLatin1());
}
}
delete textPart;
delete composer;
}
......@@ -78,6 +78,7 @@ void MultipartJobTest::testMultipartMixed()
QVERIFY(c->contentType(false));
QCOMPARE(c->contentType()->mimeType(), type2);
}
delete composer;
}
void MultipartJobTest::test8BitPropagation()
......@@ -100,4 +101,6 @@ void MultipartJobTest::test8BitPropagation()
qDebug() << content->encodedContent();
QVERIFY(content->contentTransferEncoding(false));
QCOMPARE(content->contentTransferEncoding()->encoding(), Headers::CE8Bit);
delete mjob;
delete composer;
}
......@@ -58,6 +58,8 @@ void SkeletonMessageJobTest::testSubject()
QVERIFY(message->subject(false));
qDebug() << message->subject()->asUnicodeString();
QCOMPARE(subject, message->subject()->asUnicodeString());
delete message;
delete composer;
}
void SkeletonMessageJobTest::testAddresses_data()
......@@ -196,6 +198,8 @@ void SkeletonMessageJobTest::testAddresses()
}
QVERIFY(bcc.isEmpty());
}
delete message;
delete composer;
}
void SkeletonMessageJobTest::testMessageID()
......@@ -210,6 +214,7 @@ void SkeletonMessageJobTest::testMessageID()
KMime::Message *message = sjob->message();
QVERIFY(message->messageID(false));
QVERIFY(!message->messageID(false)->isEmpty());
delete message;
delete sjob;
delete composer;
}
......@@ -50,6 +50,10 @@ public:
: JobBasePrivate(qq)
{
}
~ComposerPrivate()
{
//delete skeletonMessage;
}
void init();
void doStart(); // slot
......
......@@ -169,6 +169,7 @@ void GrantleeHeaderStyleTest::testRenderHeaderInvalidTheme()
auto style = GrantleeHeaderStyle();
auto aMsg = new KMime::Message();
QCOMPARE(style.format(aMsg), QStringLiteral("Grantlee theme \"\" is not valid."));
delete aMsg;
}
void GrantleeHeaderStyleTest::testRenderHeaderEmpty()
......@@ -178,6 +179,7 @@ void GrantleeHeaderStyleTest::testRenderHeaderEmpty()
style.setTheme(defaultTheme());
testHeaderFile(style, aMsg, QStringLiteral("empty"));
delete aMsg;
}
void GrantleeHeaderStyleTest::testRenderHeaderVCard()
......@@ -188,6 +190,7 @@ void GrantleeHeaderStyleTest::testRenderHeaderVCard()
style.setVCardName(QStringLiteral("nofile.vcd"));
testHeaderFile(style, aMsg, QStringLiteral("vcard"));
delete aMsg;
}
void GrantleeHeaderStyleTest::testRenderHeader_data()
......
......@@ -37,11 +37,13 @@ void NodeHelperTest::testPersistentIndex()
KMime::Content *node2 = new KMime::Content();
KMime::Content *node2Extra = new KMime::Content();
KMime::Content *subNode = new KMime::Content();
KMime::Content *subsubNode = new KMime::Content(), *subsubNode2 = new KMime::Content();
KMime::Content *subsubNode = new KMime::Content();
KMime::Content *subsubNode2 = new KMime::Content();
KMime::Content *node2ExtraSubNode = new KMime::Content();
KMime::Content *node2ExtraSubsubNode = new KMime::Content();
KMime::Content *node2ExtraSubsubNode2 = new KMime::Content();
KMime::Content *extra = new KMime::Content(), *extra2 = new KMime::Content();
KMime::Content *extra = new KMime::Content();
KMime::Content *extra2 = new KMime::Content();
KMime::Content *subExtra = new KMime::Content();
KMime::Content *subsubExtra = new KMime::Content();
KMime::Content *subsubExtraNode = new KMime::Content();
......@@ -121,6 +123,8 @@ void NodeHelperTest::testPersistentIndex()
QCOMPARE(helper.persistentIndex(node2ExtraSubsubNode2), QStringLiteral("e0:2.3"));
QCOMPARE(helper.contentFromIndex(node2, QStringLiteral("e0:2.3")), node2ExtraSubsubNode2);
helper.clear();
delete node2;
delete node;
}
......
......@@ -1143,6 +1143,8 @@ void EncryptedMessagePart::startDecryption(const QByteArray &text, const QTextCo
setText(aCodec->toUnicode(mDecryptedData));
}
}
//Verify it
//delete content;
}
bool EncryptedMessagePart::okDecryptMIME(KMime::Content &data)
......@@ -1337,6 +1339,7 @@ void EncryptedMessagePart::startDecryption(KMime::Content *data)
parseInternal(tempNode, false);
}
}
}
QString EncryptedMessagePart::plaintextContent() const
......
......@@ -100,6 +100,7 @@ void TemplateParserJobTest::test_convertedHtml()
QVERIFY(!convertedHtmlContent.isEmpty());
QCOMPARE(convertedHtmlContent, referenceData);
delete parser;
}
void TemplateParserJobTest::test_replyHtml_data()
......@@ -159,6 +160,7 @@ void TemplateParserJobTest::test_replyHtml()
}
QCOMPARE(convertedHtmlContent, referenceData);
delete parser;
}
void TemplateParserJobTest::test_replyPlain_data()
......@@ -209,6 +211,7 @@ void TemplateParserJobTest::test_replyPlain()
const QString convertedPlainTextContent = parser->plainMessageText(false, TemplateParser::TemplateParserJob::NoSelectionAllowed);
QCOMPARE(convertedPlainTextContent, referenceData);
delete parser;
}
void TemplateParserJobTest::test_forwardPlain_data()
......@@ -313,6 +316,7 @@ void TemplateParserJobTest::test_forwardHtml()
}
QCOMPARE(convertedHtmlContent, referenceData);
delete parser;
}
void TemplateParserJobTest::test_forwardedAttachments_data()
......@@ -420,6 +424,7 @@ void TemplateParserJobTest::test_processWithTemplatesForBody()
identMan->deleteLater();
QCOMPARE(QString::fromLatin1(msg->encodedBody()), expected);
QCOMPARE(spy.count(), 1);
delete parser;
}
void TemplateParserJobTest::test_processWithTemplatesForContent_data()
......
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