mirror of https://gitee.com/openkylin/qemu.git
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: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This commit is contained in:
parent
bb16172c52
commit
a46667ea29
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue