提交 c7ee8f68 编写于 作者: Z Zhi Hui Li 提交者: Stefan Hajnoczi

net/socket.c : fix memory leak

Signed-off-by: NLi Zhi Hui <zhihuili@linux.vnet.ibm.com>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 b48e3611
......@@ -409,6 +409,7 @@ static int net_socket_listen_init(VLANState *vlan,
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
g_free(s);
return -1;
}
socket_set_nonblock(fd);
......@@ -420,11 +421,13 @@ static int net_socket_listen_init(VLANState *vlan,
ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
perror("bind");
g_free(s);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
g_free(s);
return -1;
}
s->vlan = vlan;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册