Currently if we fail to set up the watch waiting for accept() to be called on the socket, we still keep the network socket open even if we are not going to be able to use it. This commit makes sure it's closed a set to -1 when such a failure occurs. --- server/reds.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/reds.c b/server/reds.c index a31ed4e96..7867e8573 100644 --- a/server/reds.c +++ b/server/reds.c @@ -2595,6 +2595,8 @@ static int reds_init_net(RedsState *reds) SPICE_WATCH_EVENT_READ, reds_accept, reds); if (reds->listen_watch == NULL) { + close(reds->listen_socket); + reds->listen_socket = -1; spice_warning("set fd handle failed"); return -1; } @@ -2610,6 +2612,8 @@ static int reds_init_net(RedsState *reds) SPICE_WATCH_EVENT_READ, reds_accept_ssl_connection, reds); if (reds->secure_listen_watch == NULL) { + close(reds->secure_listen_socket); + reds->secure_listen_socket = -1; spice_warning("set fd handle failed"); return -1; } @@ -2621,6 +2625,7 @@ static int reds_init_net(RedsState *reds) SPICE_WATCH_EVENT_READ, reds_accept, reds); if (reds->listen_watch == NULL) { + reds->listen_socket = -1; spice_warning("set fd handle failed"); return -1; } -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel