From patchwork Thu Feb 11 12:18:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 8278901 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 787429F88A for ; Thu, 11 Feb 2016 12:27:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2C8F2039E for ; Thu, 11 Feb 2016 12:27:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AC2320380 for ; Thu, 11 Feb 2016 12:27:47 +0000 (UTC) Received: from localhost ([::1]:49288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTqLa-0006IB-J3 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 11 Feb 2016 07:27:46 -0500 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 Received: from isrv.corpit.ru ([86.62.121.231]:33935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTqLG-00005M-7S; Thu, 11 Feb 2016 07:27:26 -0500 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B8B1141455; Thu, 11 Feb 2016 15:19:05 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id A7DD1A99; Thu, 11 Feb 2016 15:19:04 +0300 (MSK) Received: (nullmailer pid 11181 invoked by uid 1000); Thu, 11 Feb 2016 12:19:04 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Thu, 11 Feb 2016 15:18:54 +0300 Message-Id: <58c652c08acaabcf5f22d33021d9ffeae2f59263.1455192968.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Paolo Bonzini , Michael Tokarev Subject: [Qemu-devel] [PULL 05/14] qemu-sockets: simplify error handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */