提交 a46667ea 编写于 作者: P Peter Maydell 提交者: Stefan Hajnoczi

net/socket.c: Fix fd leak in net_socket_listen_init() error paths

Fix a leak of a file descriptor due to missing closesocket() calls
in error paths in net_socket_listen_init().
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 bb16172c
......@@ -427,12 +427,14 @@ static int net_socket_listen_init(VLANState *vlan,
if (ret < 0) {
perror("bind");
g_free(s);
closesocket(fd);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
g_free(s);
closesocket(fd);
return -1;
}
s->vlan = vlan;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册