diff --git a/net/socket.c b/net/socket.c index d2336472f494..379b3a390755 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2235,6 +2235,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) err = sock->ops->accept(sock, *newsock, flags); if (err < 0) { sock_release(*newsock); + *newsock = NULL; goto done; }