qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PULL 05/14] qemu-sockets: simplify error handling


From: Michael Tokarev
Subject: [Qemu-trivial] [PULL 05/14] qemu-sockets: simplify error handling
Date: Thu, 11 Feb 2016 15:18:54 +0300

From: Paolo Bonzini <address@hidden>

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 <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
 util/qemu-sockets.c | 6 +++---
 1 file 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 */
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]