Qt/C++ QTcpSocket causes memory leak, not sure why
问题 I am creating a simple(ish) telnet server and am now debugging with valgrind. the code runs great, but valgrind complains about memory lost when the program terminates...and the culprit is the line where I create a new QTcpSocket: void TelnetConnection::run() { tcpSocketPtr = new QTcpSocket(); // ** remove this due to parent error if (!tcpSocketPtr->setSocketDescriptor(socketDescriptor)) { emit error(tcpSocketPtr->error()); return; } } I tried passing 'this' to the QTcpSocket() but then the