diff options
author | Peter Maydell | 2011-12-25 00:47:11 +0100 |
---|---|---|
committer | Stefan Hajnoczi | 2012-01-06 16:07:14 +0100 |
commit | a46667ea29218565473e430ceae62e2838f6ce3f (patch) | |
tree | 5bb29acbe34491cd2272608d97950cb73ecbb67d /net | |
parent | gdbstub: Fix fd leak in gdbserver_open() error path (diff) | |
download | qemu-a46667ea29218565473e430ceae62e2838f6ce3f.tar.gz qemu-a46667ea29218565473e430ceae62e2838f6ce3f.tar.xz qemu-a46667ea29218565473e430ceae62e2838f6ce3f.zip |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/socket.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c index aaf9be48e2..c9d70d388e 100644 --- a/net/socket.c +++ b/net/socket.c @@ -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; |