aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
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 b3545f5709..37969eb15e 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);
}