aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2017-10-27 12:23:29 +0200
committerJuan Quintela <quintela@redhat.com>2018-01-15 12:47:55 +0100
commit9102d27e33b2a5b676ce3eb73b714c1f92062058 (patch)
treee20f3aad1b52353c1993c9c940b953476783489e /migration
parent6f0f6428351d09dd904bf81b137bdd4fd25ba029 (diff)
downloadqemu-9102d27e33b2a5b676ce3eb73b714c1f92062058.zip
qemu-9102d27e33b2a5b676ce3eb73b714c1f92062058.tar.gz
qemu-9102d27e33b2a5b676ce3eb73b714c1f92062058.tar.bz2
migration: free addr in the same function that we created it
Otherwise, we can't use it after calling socket_start_incoming_migration Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/migration/socket.c b/migration/socket.c
index dee8690..3a8232d 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -172,7 +172,6 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {
object_unref(OBJECT(listen_ioc));
- qapi_free_SocketAddress(saddr);
return;
}
@@ -181,7 +180,6 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
socket_accept_incoming_migration,
listen_ioc,
(GDestroyNotify)object_unref);
- qapi_free_SocketAddress(saddr);
}
void tcp_start_incoming_migration(const char *host_port, Error **errp)
@@ -191,6 +189,7 @@ void tcp_start_incoming_migration(const char *host_port, Error **errp)
if (!err) {
socket_start_incoming_migration(saddr, &err);
}
+ qapi_free_SocketAddress(saddr);
error_propagate(errp, err);
}
@@ -198,4 +197,5 @@ void unix_start_incoming_migration(const char *path, Error **errp)
{
SocketAddress *saddr = unix_build_address(path);
socket_start_incoming_migration(saddr, errp);
+ qapi_free_SocketAddress(saddr);
}