Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
gdbstub: Prevent fd leakage
Browse files Browse the repository at this point in the history
Since 2f65222, 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>
  • Loading branch information
philmd authored and bonzini committed Jun 1, 2018
1 parent 3a0adfc commit ead75d8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,7 @@ static bool gdb_accept(void)
/* set short latency */
if (socket_set_nodelay(fd)) {
perror("setsockopt");
close(fd);
return false;
}

Expand Down

0 comments on commit ead75d8

Please sign in to comment.