From 788d4856330e6f5d251f9b153de3d22b8cf538f1 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 26 Jun 2020 11:37:19 +0200 Subject: QSslServer - adopt the newly created socket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like it's done in QTcpServer. In theory, it's possible that 'encrypted' signal is never executed and then the socket is not added to the pending connections (those are deleted in the QTcpServer::close). Thus, the socket object would be leaked. Since QSslServer inherits from QTcpServer, this fix also ensures the documented behavior of the QTcpServer::nextPendingConnection (which is said to return a child of the server object). Fixes: QTBUG-85180 Pick-to: 5.15 Change-Id: Ic0d923b7a7fe5e3bcea0b9815be1cbe946dda186 Reviewed-by: MÃ¥rten Nordheim --- src/websockets/qsslserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/websockets/qsslserver.cpp b/src/websockets/qsslserver.cpp index 7f33a9d..ed4e4c0 100644 --- a/src/websockets/qsslserver.cpp +++ b/src/websockets/qsslserver.cpp @@ -107,7 +107,7 @@ QSslConfiguration QSslServer::sslConfiguration() const */ void QSslServer::incomingConnection(qintptr socket) { - QSslSocket *pSslSocket = new QSslSocket(); + QSslSocket *pSslSocket = new QSslSocket(this); if (Q_LIKELY(pSslSocket)) { pSslSocket->setSslConfiguration(m_sslConfiguration); -- cgit v1.2.1