diff options
author | Matt Caswell <matt@openssl.org> | 2016-04-27 13:46:51 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-04-28 14:13:09 +0200 |
commit | df0f2759220f825efe1a77eae9e658fe37cc89c3 (patch) | |
tree | 34597d86507b694a1ae51bc4ae4ca53e4f3cf6f6 /crypto/bio | |
parent | Make BIO_sock_error return a proper error code when getsockopt fails (diff) | |
download | openssl-df0f2759220f825efe1a77eae9e658fe37cc89c3.tar.xz openssl-df0f2759220f825efe1a77eae9e658fe37cc89c3.zip |
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>
Diffstat (limited to 'crypto/bio')
-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; } |