提交 e24e4065 编写于 作者: R Richard Levitte

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>
上级 448361a8
......@@ -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)|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册