aboutsummaryrefslogtreecommitdiff
path: root/migration-tcp.c
diff options
context:
space:
mode:
authorShahar Havivi <shaharh@redhat.com>2010-07-24 13:03:07 +0300
committerAurelien Jarno <aurelien@aurel32.net>2010-07-25 17:03:51 +0200
commitd092c108ffba9a8d6cb1dcc7b77d896312f4c837 (patch)
treeee32b6fcbf5bc06adb2e13b3341a79ec88a024a1 /migration-tcp.c
parent01cc7ac69e1cd6c46754457a439c6cbd76be4155 (diff)
downloadqemu-d092c108ffba9a8d6cb1dcc7b77d896312f4c837.zip
qemu-d092c108ffba9a8d6cb1dcc7b77d896312f4c837.tar.gz
qemu-d092c108ffba9a8d6cb1dcc7b77d896312f4c837.tar.bz2
Close socket file descriptor when qemu_accept fails
Signed-off-by: Shahar Havivi <shaharh@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'migration-tcp.c')
-rw-r--r--migration-tcp.c5
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)