summaryrefslogtreecommitdiff
path: root/Servers/TelnetServer/Client.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-08 19:12:52 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-08 19:12:52 +0100
commitfc85d173226a0aed6b02f072271c2a667b01ec8e (patch)
tree2a2ac6879e8fb73e5f2f8c2dfe05287a4dbdc99a /Servers/TelnetServer/Client.cpp
parentdeb154be61867c1b23605037d3693f7980a3b9a0 (diff)
downloadserenity-fc85d173226a0aed6b02f072271c2a667b01ec8e.zip
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.
Diffstat (limited to 'Servers/TelnetServer/Client.cpp')
-rw-r--r--Servers/TelnetServer/Client.cpp1
1 files changed, 1 insertions, 0 deletions
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<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);