1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

Kernel: Avoid file descriptor leak in Process::sys$socketpair on error

Previously it was possible to leak the file descriptor if we error out
after allocating the first descriptor. Now we perform both fd
allocations back to back so we can handle the potential error when
processing the second fd allocation.
This commit is contained in:
Brian Gianforcaro 2021-07-28 01:49:04 -07:00 committed by Andreas Kling
parent 4b2651ddab
commit ddc950ce42
2 changed files with 12 additions and 10 deletions

View file

@ -15,8 +15,8 @@ namespace Kernel {
class FileDescription;
struct SocketPair {
NonnullRefPtr<FileDescription> description0;
NonnullRefPtr<FileDescription> description1;
NonnullRefPtr<FileDescription> description2;
};
class LocalSocket final : public Socket {