From 838223b14b269edbb343b4f11b15d84ab16a2899 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 26 Sep 2012 20:23:31 +0100 Subject: [PATCH] Close ssl_sock before returning error in connect_https_socket() Spotted by Coverity. Signed-off-by: David Woodhouse --- ssl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.49.0