summaryrefslogtreecommitdiff
path: root/Kernel/Net
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Net')
-rw-r--r--Kernel/Net/IPv4Socket.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 728b4b1c37..c8ebed1ae7 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -44,8 +44,12 @@ KResultOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
}
if (type == SOCK_DGRAM)
return UDPSocket::create(protocol);
- if (type == SOCK_RAW)
- return adopt_ref(*new IPv4Socket(type, protocol));
+ if (type == SOCK_RAW) {
+ auto raw_socket = adopt_ref_if_nonnull(new IPv4Socket(type, protocol));
+ if (raw_socket)
+ return raw_socket.release_nonnull();
+ return ENOMEM;
+ }
return EINVAL;
}