From: Matt Caswell Date: Wed, 27 Apr 2016 11:46:51 +0000 (+0100) Subject: Close the accept socket on error X-Git-Tag: OpenSSL_1_1_0-pre6~1037 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=df0f2759220f825efe1a77eae9e658fe37cc89c3;p=oweals%2Fopenssl.git 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: Richard Levitte --- diff --git a/crypto/bio/b_sock2.c b/crypto/bio/b_sock2.c index 9f092fc073..e876e07f1b 100644 --- a/crypto/bio/b_sock2.c +++ b/crypto/bio/b_sock2.c @@ -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; }