summaryrefslogtreecommitdiff
path: root/main/openssl/apps/s_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/openssl/apps/s_socket.c')
-rw-r--r--main/openssl/apps/s_socket.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/openssl/apps/s_socket.c b/main/openssl/apps/s_socket.c
index 380efdb1..94eb40f3 100644
--- a/main/openssl/apps/s_socket.c
+++ b/main/openssl/apps/s_socket.c
@@ -274,7 +274,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
{
i=0;
i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
- if (i < 0) { perror("keepalive"); return(0); }
+ if (i < 0) { closesocket(s); perror("keepalive"); return(0); }
}
#endif
@@ -450,6 +450,7 @@ redoit:
if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL)
{
perror("OPENSSL_malloc");
+ closesocket(ret);
return(0);
}
BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1);
@@ -458,11 +459,13 @@ redoit:
if (h2 == NULL)
{
BIO_printf(bio_err,"gethostbyname failure\n");
+ closesocket(ret);
return(0);
}
if (h2->h_addrtype != AF_INET)
{
BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
+ closesocket(ret);
return(0);
}
}