aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-04-18 20:26:47 -0400
committerNick Mathewson <nickm@torproject.org>2014-04-18 20:26:47 -0400
commit08325b58bef83bfed181c493f269ef57477152c0 (patch)
tree7e685f9b0ed310fe10c687b854beb7c48f0e724e /src/common
parent0cca8dc35a4e59944b83db0a36c7033e09fb98b4 (diff)
downloadtor-08325b58bef83bfed181c493f269ef57477152c0.tar
tor-08325b58bef83bfed181c493f269ef57477152c0.tar.gz
scan-build: Add a check for result from getaddrinfo
As documented, getaddrinfo always sets its result when it returns no error. But scan-build doesn't know that, and thinks we might be def
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/address.c b/src/common/address.c
index e5930dedc..2825b123d 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -236,7 +236,9 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
err = sandbox_getaddrinfo(name, NULL, &hints, &res);
- if (!err) {
+ /* The check for 'res' here shouldn't be necessary, but it makes static
+ * analysis tools happy. */
+ if (!err && res) {
best = NULL;
for (res_p = res; res_p; res_p = res_p->ai_next) {
if (family == AF_UNSPEC) {