diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-12-24 23:37:24 +0000 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2012-01-06 15:07:14 +0000 |
commit | bb16172c52ac18742f3df156912c169904e92147 (patch) | |
tree | 04362893c6a2603f59f8c139427706d9db9ec2d9 | |
parent | 359bc95d3e604e22fe07be62f5099148a2bb4e6f (diff) | |
download | qemu-bb16172c52ac18742f3df156912c169904e92147.tar.gz qemu-bb16172c52ac18742f3df156912c169904e92147.tar.bz2 qemu-bb16172c52ac18742f3df156912c169904e92147.zip |
gdbstub: Fix fd leak in gdbserver_open() error path
Fix a leak of a file descriptor in error exit paths in
gdbserver_open().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
-rw-r--r-- | gdbstub.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2762,11 +2762,13 @@ static int gdbserver_open(int port) ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); if (ret < 0) { perror("bind"); + close(fd); return -1; } ret = listen(fd, 0); if (ret < 0) { perror("listen"); + close(fd); return -1; } return fd; |