1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
Required for plaintext-upgrade-attack.patch to run successfully.
From 91d19cb8530cb8df6ec0ee0580abcd98f1957395 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jkt@kde.org>
Date: Mon, 5 Sep 2016 12:47:28 +0200
Subject: [PATCH] tests: fix more memleaks
There's some progress, but still plenty of stuff to do:
-SUMMARY: AddressSanitizer: 77490 byte(s) leaked in 1010 allocation(s).
+SUMMARY: AddressSanitizer: 7720 byte(s) leaked in 95 allocation(s).
Change-Id: I133fda902a9bd3f9fe697d7ffe8c57a159c887d8
---
tests/Imap/test_Imap_Tasks_OpenConnection.cpp | 16 ++++++++--------
tests/Imap/test_Imap_Tasks_OpenConnection.h | 14 +++++++-------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/tests/Imap/test_Imap_Tasks_OpenConnection.cpp b/tests/Imap/test_Imap_Tasks_OpenConnection.cpp
index b3a95636..c40297ab 100644
--- a/tests/Imap/test_Imap_Tasks_OpenConnection.cpp
+++ b/tests/Imap/test_Imap_Tasks_OpenConnection.cpp
@@ -35,12 +35,11 @@ void ImapModelOpenConnectionTest::initTestCase()
{
LibMailboxSync::initTestCase();
qRegisterMetaType<Imap::Mailbox::ImapTask*>();
- completedSpy = 0;
- m_enableAutoLogin = true;
}
void ImapModelOpenConnectionTest::init()
{
+ m_enableAutoLogin = true;
reinit(TlsRequired::No);
}
@@ -56,13 +55,14 @@ void ImapModelOpenConnectionTest::reinit(const TlsRequired tlsRequired)
connect(model, &Imap::Mailbox::Model::needsSslDecision, this, &ImapModelOpenConnectionTest::acceptSsl, Qt::QueuedConnection);
LibMailboxSync::setModelNetworkPolicy(model, Imap::Mailbox::NETWORK_ONLINE);
QCoreApplication::processEvents();
+ delete task;
task = new Imap::Mailbox::OpenConnectionTask(model);
- completedSpy = new QSignalSpy(task, SIGNAL(completed(Imap::Mailbox::ImapTask*)));
- failedSpy = new QSignalSpy(task, SIGNAL(failed(QString)));
- authSpy = new QSignalSpy(model, SIGNAL(authRequested()));
- connErrorSpy = new QSignalSpy(model, SIGNAL(imapError(QString)));
- startTlsUpgradeSpy = new QSignalSpy(model, SIGNAL(requireStartTlsInFuture()));
- authErrorSpy = new QSignalSpy(model, SIGNAL(imapAuthErrorChanged(const QString&)));
+ completedSpy.reset(new QSignalSpy(task, SIGNAL(completed(Imap::Mailbox::ImapTask*))));
+ failedSpy.reset(new QSignalSpy(task, SIGNAL(failed(QString))));
+ authSpy.reset(new QSignalSpy(model, SIGNAL(authRequested())));
+ connErrorSpy.reset(new QSignalSpy(model, SIGNAL(imapError(QString))));
+ startTlsUpgradeSpy.reset(new QSignalSpy(model, SIGNAL(requireStartTlsInFuture())));
+ authErrorSpy.reset(new QSignalSpy(model, SIGNAL(imapAuthErrorChanged(const QString&))));
t.reset();
}
diff --git a/tests/Imap/test_Imap_Tasks_OpenConnection.h b/tests/Imap/test_Imap_Tasks_OpenConnection.h
index 30f531a2..4df65c05 100644
--- a/tests/Imap/test_Imap_Tasks_OpenConnection.h
+++ b/tests/Imap/test_Imap_Tasks_OpenConnection.h
@@ -78,13 +78,13 @@ protected:
void reinit(const TlsRequired tlsRequired = TlsRequired::No);
private:
- Imap::Mailbox::OpenConnectionTask* task;
- QSignalSpy* completedSpy;
- QSignalSpy* failedSpy;
- QSignalSpy* authSpy;
- QSignalSpy *connErrorSpy;
- QSignalSpy *startTlsUpgradeSpy;
- QSignalSpy *authErrorSpy;
+ QPointer<Imap::Mailbox::OpenConnectionTask> task;
+ std::unique_ptr<QSignalSpy> completedSpy;
+ std::unique_ptr<QSignalSpy> failedSpy;
+ std::unique_ptr<QSignalSpy> authSpy;
+ std::unique_ptr<QSignalSpy> connErrorSpy;
+ std::unique_ptr<QSignalSpy> startTlsUpgradeSpy;
+ std::unique_ptr<QSignalSpy> authErrorSpy;
bool m_enableAutoLogin;
};
--
GitLab
|