aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-05-24 19:34:58 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-06-01 15:14:31 +0200
commitead75d84cb076d51357ca0a48a2bbaf75e5466f5 (patch)
treed21052fcc1d40a33f9513df57b24d748f3aab211
parent3a0adfc9bfcf217017bfc49d00c9a9b845e7118d (diff)
downloadqemu-ead75d84cb076d51357ca0a48a2bbaf75e5466f5.zip
qemu-ead75d84cb076d51357ca0a48a2bbaf75e5466f5.tar.gz
qemu-ead75d84cb076d51357ca0a48a2bbaf75e5466f5.tar.bz2
gdbstub: Prevent fd leakage
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> Message-Id: <20180524223458.5651-1-f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--gdbstub.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 6081e71..d6ab950 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1842,6 +1842,7 @@ static bool gdb_accept(void)
/* set short latency */
if (socket_set_nodelay(fd)) {
perror("setsockopt");
+ close(fd);
return false;
}