qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage
@ 2018-05-24 22:34 Philippe Mathieu-Daudé
  2018-05-25  3:37 ` Thomas Huth
  2018-05-25 13:52 ` Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-24 22:34 UTC (permalink / raw)
  To: Peter Maydell, Paolo Bonzini
  Cc: Philippe Mathieu-Daudé, qemu-devel, Thomas Huth,
	Michael Tokarev

Since 2f652224f7, we now check if socket_set_nodelay() errored,
but forgot to close the socket before reporting an error.

Fixes: Coverity CID 1391290 (RESOURCE_LEAK)
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 gdbstub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdbstub.c b/gdbstub.c
index e4ece2f5bc..9c860cd81c 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1836,6 +1836,7 @@ static bool gdb_accept(void)
     /* set short latency */
     if (socket_set_nodelay(fd)) {
         perror("setsockopt");
+        close(fd);
         return false;
     }
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-25 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24 22:34 [Qemu-devel] [PATCH] gdbstub: Prevent fd leakage Philippe Mathieu-Daudé
2018-05-25  3:37 ` Thomas Huth
2018-05-25 13:52 ` Peter Maydell

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).