aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-04-26 09:36:37 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-05-09 09:14:40 +0200
commit0785bd7a7c58ffaf533f484cb0661671a64ecffd (patch)
treec2edcdd19a9e8075bc1536175bcecf40feac2090 /migration
parent4db5c619a2f03c2ee25105b4f6359075c825aecc (diff)
sockets: Prepare inet_parse() for flattened SocketAddress
I'm going to flatten SocketAddress: rename SocketAddress to SocketAddressLegacy, SocketAddressFlat to SocketAddress, eliminate SocketAddressLegacy except in external interfaces. inet_parse() returns a newly allocated InetSocketAddress. Lift the allocation from inet_parse() into its caller socket_parse() to prepare for flattening SocketAddress. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1493192202-3184-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Straightforward rebase]
Diffstat (limited to 'migration')
-rw-r--r--migration/rdma.c4
-rw-r--r--migration/socket.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/migration/rdma.c b/migration/rdma.c
index fe0a4b5a83..7eaaf96479 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2506,8 +2506,8 @@ static void *qemu_rdma_data_init(const char *host_port, Error **errp)
rdma->current_index = -1;
rdma->current_chunk = -1;
- addr = inet_parse(host_port, NULL);
- if (addr != NULL) {
+ addr = g_new(InetSocketAddress, 1);
+ if (!inet_parse(addr, host_port, NULL)) {
rdma->port = atoi(addr->port);
rdma->host = g_strdup(addr->host);
} else {
diff --git a/migration/socket.c b/migration/socket.c
index dc88812048..5fdc723ca3 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -27,10 +27,11 @@
static SocketAddress *tcp_build_address(const char *host_port, Error **errp)
{
- InetSocketAddress *iaddr = inet_parse(host_port, errp);
+ InetSocketAddress *iaddr = g_new(InetSocketAddress, 1);
SocketAddress *saddr;
- if (!iaddr) {
+ if (inet_parse(iaddr, host_port, errp)) {
+ qapi_free_InetSocketAddress(iaddr);
return NULL;
}