diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/error.c | 1 | ||||
-rw-r--r-- | util/qemu-sockets.c | 38 |
2 files changed, 22 insertions, 17 deletions
diff --git a/util/error.c b/util/error.c index 9c40b1f458..020b86b9f0 100644 --- a/util/error.c +++ b/util/error.c @@ -134,6 +134,7 @@ void error_vprepend(Error **errp, const char *fmt, va_list ap) newmsg = g_string_new(NULL); g_string_vprintf(newmsg, fmt, ap); g_string_append(newmsg, (*errp)->msg); + g_free((*errp)->msg); (*errp)->msg = g_string_free(newmsg, 0); } diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 21442c30dc..8188d9a8d7 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -427,8 +427,9 @@ static struct addrinfo *inet_parse_connect_saddr(InetSocketAddress *saddr, * function succeeds, callback will be called when the connection * completes, with the file descriptor on success, or -1 on error. */ -int inet_connect_saddr(InetSocketAddress *saddr, Error **errp, - NonBlockingConnectHandler *callback, void *opaque) +int inet_connect_saddr(InetSocketAddress *saddr, + NonBlockingConnectHandler *callback, void *opaque, + Error **errp) { Error *local_err = NULL; struct addrinfo *res, *e; @@ -659,7 +660,7 @@ int inet_connect(const char *str, Error **errp) addr = inet_parse(str, errp); if (addr != NULL) { - sock = inet_connect_saddr(addr, errp, NULL, NULL); + sock = inet_connect_saddr(addr, NULL, NULL, errp); qapi_free_InetSocketAddress(addr); } return sock; @@ -727,9 +728,10 @@ static int vsock_connect_addr(const struct sockaddr_vm *svm, bool *in_progress, return sock; } -static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp, +static int vsock_connect_saddr(VsockSocketAddress *vaddr, NonBlockingConnectHandler *callback, - void *opaque) + void *opaque, + Error **errp) { struct sockaddr_vm svm; int sock = -1; @@ -818,9 +820,9 @@ static void vsock_unsupported(Error **errp) error_setg(errp, "socket family AF_VSOCK unsupported"); } -static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp, +static int vsock_connect_saddr(VsockSocketAddress *vaddr, NonBlockingConnectHandler *callback, - void *opaque) + void *opaque, Error **errp) { vsock_unsupported(errp); return -1; @@ -910,8 +912,9 @@ err: return -1; } -static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp, - NonBlockingConnectHandler *callback, void *opaque) +static int unix_connect_saddr(UnixSocketAddress *saddr, + NonBlockingConnectHandler *callback, void *opaque, + Error **errp) { struct sockaddr_un un; ConnectState *connect_state = NULL; @@ -978,8 +981,9 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, return -1; } -static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp, - NonBlockingConnectHandler *callback, void *opaque) +static int unix_connect_saddr(UnixSocketAddress *saddr, + NonBlockingConnectHandler *callback, void *opaque, + Error **errp) { error_setg(errp, "unix sockets are not available on windows"); errno = ENOTSUP; @@ -1025,7 +1029,7 @@ int unix_connect(const char *path, Error **errp) saddr = g_new0(UnixSocketAddress, 1); saddr->path = g_strdup(path); - sock = unix_connect_saddr(saddr, errp, NULL, NULL); + sock = unix_connect_saddr(saddr, NULL, NULL, errp); qapi_free_UnixSocketAddress(saddr); return sock; } @@ -1074,18 +1078,18 @@ fail: return NULL; } -int socket_connect(SocketAddress *addr, Error **errp, - NonBlockingConnectHandler *callback, void *opaque) +int socket_connect(SocketAddress *addr, NonBlockingConnectHandler *callback, + void *opaque, Error **errp) { int fd; switch (addr->type) { case SOCKET_ADDRESS_KIND_INET: - fd = inet_connect_saddr(addr->u.inet.data, errp, callback, opaque); + fd = inet_connect_saddr(addr->u.inet.data, callback, opaque, errp); break; case SOCKET_ADDRESS_KIND_UNIX: - fd = unix_connect_saddr(addr->u.q_unix.data, errp, callback, opaque); + fd = unix_connect_saddr(addr->u.q_unix.data, callback, opaque, errp); break; case SOCKET_ADDRESS_KIND_FD: @@ -1097,7 +1101,7 @@ int socket_connect(SocketAddress *addr, Error **errp, break; case SOCKET_ADDRESS_KIND_VSOCK: - fd = vsock_connect_saddr(addr->u.vsock.data, errp, callback, opaque); + fd = vsock_connect_saddr(addr->u.vsock.data, callback, opaque, errp); break; default: |