aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2001-02-05 09:15:09 +0000
committerRichard Levitte <levitte@openssl.org>2001-02-05 09:15:09 +0000
commite24e40657f7318248356699e8ec99cb746450708 (patch)
tree5af7e65df1581b484ba7d3117165c31c5e8a46cf /crypto
parent448361a86cc3cee2947a5f47e5313646b489af67 (diff)
downloadopenssl-e24e40657f7318248356699e8ec99cb746450708.zip
openssl-e24e40657f7318248356699e8ec99cb746450708.tar.gz
openssl-e24e40657f7318248356699e8ec99cb746450708.tar.bz2
Fix a memory leak in BIO_get_accept_socket(). This leak was small and
only happened when the port number wasn't parsable ot the host wasn't possible to convert to an IP address. Contributed by Niko Baric <Niko.Baric@epost.de>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/b_sock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index da2ff29..701a04b 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -519,10 +519,10 @@ int BIO_get_accept_socket(char *host, int bind_mode)
{
int ret=0;
struct sockaddr_in server,client;
- int s= -1,cs;
+ int s=INVALID_SOCKET,cs;
unsigned char ip[4];
unsigned short port;
- char *str,*e;
+ char *str=NULL,*e;
const char *h,*p;
unsigned long l;
int err_num;
@@ -553,7 +553,7 @@ int BIO_get_accept_socket(char *host, int bind_mode)
h="*";
}
- if (!BIO_get_port(p,&port)) return(INVALID_SOCKET);
+ if (!BIO_get_port(p,&port)) goto err;
memset((char *)&server,0,sizeof(server));
server.sin_family=AF_INET;
@@ -563,7 +563,7 @@ int BIO_get_accept_socket(char *host, int bind_mode)
server.sin_addr.s_addr=INADDR_ANY;
else
{
- if (!BIO_get_host_ip(h,&(ip[0]))) return(INVALID_SOCKET);
+ if (!BIO_get_host_ip(h,&(ip[0]))) goto err;
l=(unsigned long)
((unsigned long)ip[0]<<24L)|
((unsigned long)ip[1]<<16L)|