mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
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:
committed by
Stefan Hajnoczi
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;
|
||||
|
||||
Reference in New Issue
Block a user