From patchwork Sat Jul 24 10:03:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Close socket file descriptor when qemu_accept fails Date: Sat, 24 Jul 2010 00:03:07 -0000 From: Shahar Havivi X-Patchwork-Id: 59853 Message-Id: <20100724100303.GA23454@redhat.com> To: qemu-devel@nongnu.org Signed-off-by: Shahar Havivi --- migration-tcp.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration-tcp.c b/migration-tcp.c index 78b56dc..b55f419 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -151,7 +151,7 @@ static void tcp_accept_incoming_migration(void *opaque) if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); - return; + goto out2; } f = qemu_fopen_socket(c); @@ -163,9 +163,10 @@ static void tcp_accept_incoming_migration(void *opaque) process_incoming_migration(f); qemu_fclose(f); out: + close(c); +out2: qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); close(s); - close(c); } int tcp_start_incoming_migration(const char *host_port)