* [Qemu-devel] [PATCH] gdbstub: Fix fd leak in gdbserver_open() error path
@ 2011-12-24 23:37 Peter Maydell
2012-01-03 10:51 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2011-12-24 23:37 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, patches
Fix a leak of a file descriptor in error exit paths in
gdbserver_open().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Of no great consequence, but it was in the pile of coverity complaints
and it's a trivial fix.
gdbstub.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index a5806ef..7d470b6 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -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;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] gdbstub: Fix fd leak in gdbserver_open() error path
2011-12-24 23:37 [Qemu-devel] [PATCH] gdbstub: Fix fd leak in gdbserver_open() error path Peter Maydell
@ 2012-01-03 10:51 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2012-01-03 10:51 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-trivial, qemu-devel, patches
On Sat, Dec 24, 2011 at 11:37:24PM +0000, Peter Maydell wrote:
> Fix a leak of a file descriptor in error exit paths in
> gdbserver_open().
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Of no great consequence, but it was in the pile of coverity complaints
> and it's a trivial fix.
>
> gdbstub.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Thanks, applied to the trivial patches -next tree:
https://github.com/stefanha/qemu/commits/trivial-patches-next
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-03 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-24 23:37 [Qemu-devel] [PATCH] gdbstub: Fix fd leak in gdbserver_open() error path Peter Maydell
2012-01-03 10:51 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).