TelnetServer: Protect the Client object during drain_socket()

If parsing a command causes us to disconnect the client, we have to
defer deletion of the Client object until we're done with the socket.
This commit is contained in:
Andreas Kling 2020-02-08 19:12:52 +01:00
parent deb154be61
commit fc85d17322
Notes: sideshowbarker 2024-07-19 09:31:29 +09:00

View file

@ -57,6 +57,7 @@ Client::Client(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd)
void Client::drain_socket()
{
NonnullRefPtr<Client> protect(*this);
while (m_socket->can_read()) {
auto buf = m_socket->read(1024);