Skip to content
Snippets Groups Projects
Commit 58c652c0 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Michael Tokarev
Browse files

qemu-sockets: simplify error handling


Just go always through the err label.  (Noticed because Coverity
complains that peer is always non-NULL in the error cleanup code,
but removing the "if" is arguably more prone to introducing the
opposite bug in the future).

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarDaniel P. Berrange <berrange@redhat.com>
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
parent 945123a5
No related branches found
No related tags found
No related merge requests found
......@@ -459,7 +459,7 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
if (err) {
error_propagate(errp, err);
return -1;
goto err;
}
addr = sraddr->host;
......@@ -469,13 +469,13 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
}
if (port == NULL || strlen(port) == 0) {
error_setg(errp, "remote port not specified");
return -1;
goto err;
}
if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) {
error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
gai_strerror(rc));
return -1;
goto err;
}
/* lookup local addr */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment