diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-01-22 12:28:33 +0100 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:43:57 -0600 |
commit | 2a1c5155bac7e32667b51cfc823ac9e818d5056f (patch) | |
tree | 53f4aafd4c9a80d62c6b16aa868b2679b4caf463 /util/qemu-sockets.c | |
parent | 14d45e44a18ac61cc3d8ddb3c563e9bd301f91d2 (diff) | |
download | hqemu-2a1c5155bac7e32667b51cfc823ac9e818d5056f.zip hqemu-2a1c5155bac7e32667b51cfc823ac9e818d5056f.tar.gz |
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: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'util/qemu-sockets.c')
-rw-r--r-- | util/qemu-sockets.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index b665cdb..557da20 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -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 */ |