diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-07-28 01:49:04 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-28 19:07:00 +0200 |
commit | ddc950ce42f2db5d75097623859d47e02f0ed99c (patch) | |
tree | 02ce47cd8b540352f0b43f76d75f025c401ad133 /Kernel/Net/LocalSocket.h | |
parent | 4b2651ddab2c72106834277038dc91ffb26cd727 (diff) | |
download | serenity-ddc950ce42f2db5d75097623859d47e02f0ed99c.zip |
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.
Diffstat (limited to 'Kernel/Net/LocalSocket.h')
-rw-r--r-- | Kernel/Net/LocalSocket.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h index 818608d8a5..1fc56c59a7 100644 --- a/Kernel/Net/LocalSocket.h +++ b/Kernel/Net/LocalSocket.h @@ -15,8 +15,8 @@ namespace Kernel { class FileDescription; struct SocketPair { + NonnullRefPtr<FileDescription> description0; NonnullRefPtr<FileDescription> description1; - NonnullRefPtr<FileDescription> description2; }; class LocalSocket final : public Socket { |