diff options
author | Matt Caswell <matt@openssl.org> | 2016-04-27 12:46:51 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-04-28 13:13:09 +0100 |
commit | df0f2759220f825efe1a77eae9e658fe37cc89c3 (patch) | |
tree | 34597d86507b694a1ae51bc4ae4ca53e4f3cf6f6 | |
parent | 2bd8c8539595b8708e825d306a45ddddc17c915c (diff) |
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 <levitte@openssl.org>
-rw-r--r-- | crypto/bio/b_sock2.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; } |