Commit df0f2759 authored by Matt Caswell's avatar Matt Caswell
Browse files

Close the accept socket on error



When setting an accepted socket for non-blocking, if the operation fails
make sure we close the accepted socket.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent 2bd8c853
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -294,8 +294,10 @@ int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options)
        return INVALID_SOCKET;
    }

    if (!BIO_socket_nbio(accepted_sock, (options & BIO_SOCK_NONBLOCK) != 0))
    if (!BIO_socket_nbio(accepted_sock, (options & BIO_SOCK_NONBLOCK) != 0)) {
        closesocket(accepted_sock);
        return INVALID_SOCKET;
    }

    return accepted_sock;
}