From 2be472a07cecb039b13e5b3f8755edbb48651418 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 14 Jul 2023 14:35:46 +0200 Subject: [PATCH] tst_QTcpSocket: fix mem-leak earlyConstructedSockets is a QObject, but had no parent and was never deleted, leaking all the data is holds. Fix by giving it a parent. The code predates the begin of the public history. Change-Id: Ibc5688afd6111e84f591c37e39b6bb618d76c47a Reviewed-by: Ivan Solovev Reviewed-by: Thiago Macieira (cherry picked from commit 8cb542c2d430ffc5a6d63c404c7e700132e6364a) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index c16717e95a7..4e08b5a30fa 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -281,7 +281,7 @@ tst_QTcpSocket::tst_QTcpSocket() tmpSocket = 0; //This code relates to the socketsConstructedBeforeEventLoop test case - earlyConstructedSockets = new SocketPair; + earlyConstructedSockets = new SocketPair(this); QVERIFY(earlyConstructedSockets->create()); earlyBytesWrittenCount = 0; earlyReadyReadCount = 0;