summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-08-09 13:15:53 +0300
committerMarc Mutz <marc.mutz@kdab.com>2016-08-11 04:34:19 +0000
commit3b0ea7860372339fd557dc1affbf1001a524d5b5 (patch)
tree4d16d5e1243774e7fa2e48dcff6f18f5ce0b0fb0 /tests
parent08a3a52958b1a6cec46c3afb82b69d3dcf7ed859 (diff)
tst_QSslSocket::setLocalCertificateChain(): fix resource leak when test fail
The deleteLater() call wasn't reliably reached when tests fail, so use a QScopedPointer with QScopedPointerDeleteLater deleter. Change-Id: Ica73bc73c2a0ac1e9b77e4804f2aedcad9b662a0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 7846dc99c5..2d35081dff 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -1390,7 +1390,8 @@ void tst_QSslSocket::setLocalCertificateChain()
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- socket = new QSslSocket();
+ const QScopedPointer<QSslSocket, QScopedPointerDeleteLater> client(new QSslSocket);
+ socket = client.data();
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
@@ -1402,8 +1403,6 @@ void tst_QSslSocket::setLocalCertificateChain()
QCOMPARE(chain.size(), 2);
QCOMPARE(chain[0].serialNumber(), QByteArray("10:a0:ad:77:58:f6:6e:ae:46:93:a3:43:f9:59:8a:9e"));
QCOMPARE(chain[1].serialNumber(), QByteArray("3b:eb:99:c5:ea:d8:0b:5d:0b:97:5d:4f:06:75:4b:e1"));
-
- socket->deleteLater();
}
void tst_QSslSocket::setPrivateKey()