LibWeb: Stop leaking socket fds when sending them over IPC

The implicit constructor for IPC::File does not take ownership of the
file, which is surprising.
This commit is contained in:
Andrew Kaster 2024-04-16 13:26:00 -06:00 committed by Tim Flynn
parent 13abb1b2c7
commit 26ce8ad40f
Notes: sideshowbarker 2024-07-16 22:58:46 +09:00
2 changed files with 4 additions and 4 deletions

View file

@ -22,8 +22,8 @@ WebWorkerClient::WebWorkerClient(NonnullOwnPtr<Core::LocalSocket> socket)
WebView::SocketPair WebWorkerClient::dup_sockets()
{
WebView::SocketPair pair;
pair.socket = MUST(Core::System::dup(socket().fd().value()));
pair.fd_passing_socket = MUST(Core::System::dup(fd_passing_socket().fd().value()));
pair.socket = IPC::File(MUST(Core::System::dup(socket().fd().value())), IPC::File::CloseAfterSending);
pair.fd_passing_socket = IPC::File(MUST(Core::System::dup(fd_passing_socket().fd().value())), IPC::File::CloseAfterSending);
return pair;
}