aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c6
-rw-r--r--src/or/connection.c1
-rw-r--r--src/or/dirvote.c2
-rw-r--r--src/tools/tor-resolve.c2
4 files changed, 7 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index b9a4f8903..163afd3d2 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1307,7 +1307,8 @@ pathbias_is_new_circ_attempt(origin_circuit_t *circ)
/* cpath is a circular list. We want circs with more than one hop,
* and the second hop must be waiting for keys still (it's just
* about to get them). */
- return circ->cpath->next != circ->cpath &&
+ return circ->cpath &&
+ circ->cpath->next != circ->cpath &&
circ->cpath->next->state == CPATH_STATE_AWAITING_KEYS;
#else
/* If tagging attacks are no longer possible, we probably want to
@@ -1315,7 +1316,8 @@ pathbias_is_new_circ_attempt(origin_circuit_t *circ)
* timing-based tagging is still more useful than per-hop failure.
* In which case, we'd never want to use this.
*/
- return circ->cpath->state == CPATH_STATE_AWAITING_KEYS;
+ return circ->cpath &&
+ circ->cpath->state == CPATH_STATE_AWAITING_KEYS;
#endif
}
diff --git a/src/or/connection.c b/src/or/connection.c
index 7b0f081fd..737da7292 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1068,6 +1068,7 @@ connection_listener_new(const struct sockaddr *listensockaddr,
log_warn(LD_NET,"Unable to chown() %s socket: user %s not found.",
address, options->User);
tor_close_socket(s);
+ goto err;
} else if (chown(address, pw->pw_uid, pw->pw_gid) < 0) {
log_warn(LD_NET,"Unable to chown() %s socket: %s.",
address, strerror(errno));
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 66dc50deb..358708b6c 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -2121,7 +2121,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
digest, digest_len,
signing_key)) {
log_warn(LD_BUG, "Couldn't sign consensus networkstatus.");
- return NULL; /* This leaks, but it should never happen. */
+ goto done;
}
smartlist_add(chunks, tor_strdup(sigbuf));
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c
index 9b3aa98d1..306f6c66a 100644
--- a/src/tools/tor-resolve.c
+++ b/src/tools/tor-resolve.c
@@ -201,7 +201,7 @@ do_resolve(const char *hostname, uint32_t sockshost, uint16_t socksport,
s = tor_open_socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
if (s<0) {
log_sock_error("creating_socket", -1);
- goto err;
+ return -1;
}
memset(&socksaddr, 0, sizeof(socksaddr));