]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Move router lookup to _after_ we assert that its argument is set
authorNick Mathewson <nickm@torproject.org>
Fri, 30 Mar 2012 14:14:31 +0000 (10:14 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 30 Mar 2012 14:14:31 +0000 (10:14 -0400)
A previous commit in the 5527 branch had moved
router_get_mutable_by_digest(digest_rcvd) to happen before we did
tor_assert(digest_rcvd), which would have defeated the purpose of
the assert.

src/or/dirserv.c

index dfecbc8a098d9dc5c38b76f59d73c4948ddd514b..11f235caf40a9e7f74bdb9cf437786f6aacff0ef 100644 (file)
@@ -3271,11 +3271,13 @@ dirserv_orconn_tls_done(const char *address,
                         uint16_t or_port,
                         const char *digest_rcvd)
 {
-  routerinfo_t *ri = router_get_mutable_by_digest(digest_rcvd);
+  routerinfo_t *ri;
   time_t now = time(NULL);
   tor_assert(address);
   tor_assert(digest_rcvd);
 
+  ri = router_get_mutable_by_digest(digest_rcvd);
+
   if (ri == NULL)
     return;