]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-sockets: simplify error handling
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Jan 2016 11:28:33 +0000 (12:28 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 11 Feb 2016 12:15:46 +0000 (15:15 +0300)
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>
util/qemu-sockets.c

index b665cdb98f96e07d00817d4cb932908db45dfbaf..557da20bf2e3cf358e504fcb76c37cd4080a653b 100644 (file)
@@ -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 */