From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTqLJ-0006Ar-5t for qemu-devel@nongnu.org; Thu, 11 Feb 2016 07:27:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTqLG-00005i-HS for qemu-devel@nongnu.org; Thu, 11 Feb 2016 07:27:29 -0500 From: Michael Tokarev Date: Thu, 11 Feb 2016 15:18:54 +0300 Message-Id: <58c652c08acaabcf5f22d33021d9ffeae2f59263.1455192968.git.mjt@msgid.tls.msk.ru> In-Reply-To: References: Subject: [Qemu-devel] [PULL 05/14] qemu-sockets: simplify error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Paolo Bonzini , Michael Tokarev From: Paolo Bonzini 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 Reviewed-by: Daniel P. Berrange Signed-off-by: Michael Tokarev --- 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