From: David Woodhouse Date: Wed, 26 Sep 2012 19:23:31 +0000 (+0100) Subject: Close ssl_sock before returning error in connect_https_socket() X-Git-Tag: v4.08~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=838223b14b269edbb343b4f11b15d84ab16a2899;p=users%2Fdwmw2%2Fopenconnect.git Close ssl_sock before returning error in connect_https_socket() Spotted by Coverity. Signed-off-by: David Woodhouse --- diff --git a/ssl.c b/ssl.c index 9ad5e858..c5115e7b 100644 --- a/ssl.c +++ b/ssl.c @@ -111,17 +111,18 @@ int connect_https_socket(struct openconnect_info *vpninfo) if (cancellable_connect(vpninfo, ssl_sock, vpninfo->peer_addr, vpninfo->peer_addrlen)) { reconn_err: if (vpninfo->proxy) { - vpn_progress(vpninfo, PRG_ERR, + vpn_progress(vpninfo, PRG_ERR, _("Failed to reconnect to proxy %s\n"), vpninfo->proxy); } else { - vpn_progress(vpninfo, PRG_ERR, + vpn_progress(vpninfo, PRG_ERR, _("Failed to reconnect to host %s\n"), vpninfo->hostname); } + if (ssl_sock >= 0) + close(ssl_sock); return -EINVAL; } - } else { struct addrinfo hints, *result, *rp; char *hostname;