diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-08 19:12:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-08 19:12:52 +0100 |
commit | fc85d173226a0aed6b02f072271c2a667b01ec8e (patch) | |
tree | 2a2ac6879e8fb73e5f2f8c2dfe05287a4dbdc99a /Servers/TelnetServer/Client.cpp | |
parent | deb154be61867c1b23605037d3693f7980a3b9a0 (diff) | |
download | serenity-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.cpp | 1 |
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); |