From: Armin Novak Date: Thu, 25 Oct 2018 11:13:14 +0000 (+0200) Subject: Fixed sockfd/socketBio resource leak. X-Git-Tag: 2.0.0-rc4~29^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42014e80d0f12d2dddfa351e65b992a60b730eba;p=platform%2Fupstream%2Ffreerdp.git Fixed sockfd/socketBio resource leak. --- diff --git a/libfreerdp/core/gateway/rpc.c b/libfreerdp/core/gateway/rpc.c index 81db7c2..08813b2 100644 --- a/libfreerdp/core/gateway/rpc.c +++ b/libfreerdp/core/gateway/rpc.c @@ -671,24 +671,36 @@ static BOOL rpc_channel_tls_connect(RpcChannel* channel, int timeout) socketBio = BIO_new(BIO_s_simple_socket()); if (!socketBio) + { + close(sockfd); return FALSE; + } BIO_set_fd(socketBio, sockfd, BIO_CLOSE); bufferedBio = BIO_new(BIO_s_buffered_socket()); if (!bufferedBio) + { + BIO_free_all(socketBio); return FALSE; + } bufferedBio = BIO_push(bufferedBio, socketBio); if (!BIO_set_nonblock(bufferedBio, TRUE)) + { + BIO_free_all(bufferedBio); return FALSE; + } if (channel->client->isProxy) { if (!proxy_connect(settings, bufferedBio, proxyUsername, proxyPassword, settings->GatewayHostname, settings->GatewayPort)) + { + BIO_free_all(bufferedBio); return FALSE; + } } channel->bio = bufferedBio;