QAbstractSocket::isBuffered gets set correctly. But when one uses
the variable isBuffered doesn't get set.
Thus when calling waitForDisconnected() on an unbuffered QTcpSocket, canReadNotification() calls readFromSocket() and as no data is available, 4096 bytes get allocated. In a scenario where hundreds of sockets are used, this pollutes memory a lot.
The following code in setSocketDescriptor() right before return true; would solve the problem: