From fc85d173226a0aed6b02f072271c2a667b01ec8e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 8 Feb 2020 19:12:52 +0100 Subject: [PATCH] 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. --- Servers/TelnetServer/Client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Servers/TelnetServer/Client.cpp b/Servers/TelnetServer/Client.cpp index dd924ec4cd..e983025df6 100644 --- a/Servers/TelnetServer/Client.cpp +++ b/Servers/TelnetServer/Client.cpp @@ -57,6 +57,7 @@ Client::Client(int id, RefPtr socket, int ptm_fd) void Client::drain_socket() { + NonnullRefPtr protect(*this); while (m_socket->can_read()) { auto buf = m_socket->read(1024);