From: Tim Hudson Date: Mon, 5 May 2014 00:53:39 +0000 (+1000) Subject: coverity 966576 - close socket in error path X-Git-Tag: master-post-reformat~827 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b6e69d284b79097d0d9e39996cbe59eae6bb36e2;p=oweals%2Fopenssl.git coverity 966576 - close socket in error path --- diff --git a/apps/s_socket.c b/apps/s_socket.c index 1841607ef5..65003fb6f0 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -452,6 +452,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); @@ -460,11 +461,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); } }