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 <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8cb542c2d430ffc5a6d63c404c7e700132e6364a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-07-14 14:35:46 +02:00 committed by Qt Cherry-pick Bot
parent 8d4945fb65
commit 2be472a07c

View File

@ -281,7 +281,7 @@ tst_QTcpSocket::tst_QTcpSocket()
tmpSocket = 0; tmpSocket = 0;
//This code relates to the socketsConstructedBeforeEventLoop test case //This code relates to the socketsConstructedBeforeEventLoop test case
earlyConstructedSockets = new SocketPair; earlyConstructedSockets = new SocketPair(this);
QVERIFY(earlyConstructedSockets->create()); QVERIFY(earlyConstructedSockets->create());
earlyBytesWrittenCount = 0; earlyBytesWrittenCount = 0;
earlyReadyReadCount = 0; earlyReadyReadCount = 0;