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.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibc5688afd6111e84f591c37e39b6bb618d76c47a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-07-14 14:35:46 +02:00
parent 9f8449a054
commit 8cb542c2d4

View File

@ -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;