gdbstub: Prevent fd leakage
PATCH 1/1 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é <[email protected]>
--- gdbstub.c | 1 + 1 file changed, 1 insertion(+)
gdbstub.c +1 -0
@@ -1836,6 +1836,7 @@ static bool gdb_accept(void)/* set short latency */ if (socket_set_nodelay (fd)) {perror ("setsockopt" ); +close (fd);return false; }
Signature · 1 line
2.17.0
Quoted 14 lines · Philippe Mathieu-Daudé
Since
2f652224f7, we now check ifsocket_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é <[email protected]>--- gdbstub.c | 1 + 1 file changed, 1 insertion(+)gdbstub.c +0
-0
gdbstub.c static bool gdb_accept(void) · line 1841
Quoted 6 lines
gdbstub.c +1
-0@@ -1836,6 +1836,7 @@ static bool gdb_accept(void)/* set short latency */ if (socket_set_nodelay (fd)) {perror ("setsockopt" ); +close (fd);return false; }
Reviewed-by Thomas Huth <[email protected]>
Quoted 14 lines · Philippe Mathieu-Daudé
Since
2f652224f7, we now check ifsocket_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é <[email protected]>--- gdbstub.c | 1 + 1 file changed, 1 insertion(+)gdbstub.c +0
-0
gdbstub.c static bool gdb_accept(void) · line 1841
Quoted 6 lines
gdbstub.c +1
-0@@ -1836,6 +1836,7 @@ static bool gdb_accept(void)/* set short latency */ if (socket_set_nodelay (fd)) {perror ("setsockopt" ); +close (fd);return false; }
Reviewed-by Peter Maydell <[email protected]>
thanks
-- PMM