From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: [Qemu-trivial] [PATCH] qemu-sockets: simplify error handling
Date: Fri, 22 Jan 2016 12:28:33 +0100 [thread overview]
Message-ID: <1453462113-27119-1-git-send-email-pbonzini@redhat.com> (raw)
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>
---
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 f455a17..a9fed00 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -464,7 +464,7 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
if (err) {
error_propagate(errp, err);
- return -1;
+ goto err;
}
addr = sraddr->host;
@@ -474,13 +474,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.5.0
next reply other threads:[~2016-01-22 11:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-22 11:28 Paolo Bonzini [this message]
2016-01-22 11:31 ` [Qemu-trivial] [Qemu-devel] [PATCH] qemu-sockets: simplify error handling Daniel P. Berrange
2016-01-30 9:37 ` [Qemu-trivial] " Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453462113-27119-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).