Fixed sockfd/socketBio resource leak.
This commit is contained in:
parent
7aebf8ebd2
commit
42014e80d0
@ -671,24 +671,36 @@ static BOOL rpc_channel_tls_connect(RpcChannel* channel, int timeout)
|
|||||||
socketBio = BIO_new(BIO_s_simple_socket());
|
socketBio = BIO_new(BIO_s_simple_socket());
|
||||||
|
|
||||||
if (!socketBio)
|
if (!socketBio)
|
||||||
|
{
|
||||||
|
close(sockfd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
BIO_set_fd(socketBio, sockfd, BIO_CLOSE);
|
BIO_set_fd(socketBio, sockfd, BIO_CLOSE);
|
||||||
bufferedBio = BIO_new(BIO_s_buffered_socket());
|
bufferedBio = BIO_new(BIO_s_buffered_socket());
|
||||||
|
|
||||||
if (!bufferedBio)
|
if (!bufferedBio)
|
||||||
|
{
|
||||||
|
BIO_free_all(socketBio);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
bufferedBio = BIO_push(bufferedBio, socketBio);
|
bufferedBio = BIO_push(bufferedBio, socketBio);
|
||||||
|
|
||||||
if (!BIO_set_nonblock(bufferedBio, TRUE))
|
if (!BIO_set_nonblock(bufferedBio, TRUE))
|
||||||
|
{
|
||||||
|
BIO_free_all(bufferedBio);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (channel->client->isProxy)
|
if (channel->client->isProxy)
|
||||||
{
|
{
|
||||||
if (!proxy_connect(settings, bufferedBio, proxyUsername, proxyPassword, settings->GatewayHostname,
|
if (!proxy_connect(settings, bufferedBio, proxyUsername, proxyPassword, settings->GatewayHostname,
|
||||||
settings->GatewayPort))
|
settings->GatewayPort))
|
||||||
|
{
|
||||||
|
BIO_free_all(bufferedBio);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
channel->bio = bufferedBio;
|
channel->bio = bufferedBio;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user