diff options
Diffstat (limited to 'chardev/char-udp.c')
-rw-r--r-- | chardev/char-udp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/chardev/char-udp.c b/chardev/char-udp.c index d705c4f26b..5f2f717928 100644 --- a/chardev/char-udp.c +++ b/chardev/char-udp.c @@ -191,13 +191,17 @@ static void qmp_chardev_open_udp(Chardev *chr, Error **errp) { ChardevUdp *udp = backend->u.udp.data; + SocketAddress *local_addr = socket_address_flatten(udp->local); + SocketAddress *remote_addr = socket_address_flatten(udp->remote); QIOChannelSocket *sioc = qio_channel_socket_new(); char *name; UdpChardev *s = UDP_CHARDEV(chr); + int ret; - if (qio_channel_socket_dgram_sync(sioc, - udp->local, udp->remote, - errp) < 0) { + ret = qio_channel_socket_dgram_sync(sioc, local_addr, remote_addr, errp); + qapi_free_SocketAddress(local_addr); + qapi_free_SocketAddress(remote_addr); + if (ret < 0) { object_unref(OBJECT(sioc)); return; } |