aboutsummaryrefslogtreecommitdiff
path: root/block
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 /block
parent4db5c619a2f03c2ee25105b4f6359075c825aecc (diff)
downloadqemu-0785bd7a7c58ffaf533f484cb0661671a64ecffd.zip
qemu-0785bd7a7c58ffaf533f484cb0661671a64ecffd.tar.gz
qemu-0785bd7a7c58ffaf533f484cb0661671a64ecffd.tar.bz2
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 'block')
-rw-r--r--block/nbd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/nbd.c b/block/nbd.c
index b3545f5..37969eb 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -198,16 +198,16 @@ static void nbd_parse_filename(const char *filename, QDict *options,
qdict_put_str(options, "server.type", "unix");
qdict_put_str(options, "server.path", unixpath);
} else {
- InetSocketAddress *addr = NULL;
+ InetSocketAddress *addr = g_new(InetSocketAddress, 1);
- addr = inet_parse(host_spec, errp);
- if (!addr) {
- goto out;
+ if (inet_parse(addr, host_spec, errp)) {
+ goto out_inet;
}
qdict_put_str(options, "server.type", "inet");
qdict_put_str(options, "server.host", addr->host);
qdict_put_str(options, "server.port", addr->port);
+ out_inet:
qapi_free_InetSocketAddress(addr);
}