Commit e24e4065 authored by Richard Levitte's avatar Richard Levitte
Browse files

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>
parent 448361a8
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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)|