]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Unpack a smartlist_foreach and add an assert: try to hunt #5102
authorNick Mathewson <nickm@torproject.org>
Mon, 13 Feb 2012 00:42:35 +0000 (19:42 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 13 Feb 2012 00:42:35 +0000 (19:42 -0500)
src/or/circuitbuild.c

index 07598e242fb98934d9192b6443f903a304d5d2ae..7c404e63cb565e07d825ca27fc72aac95e6352f2 100644 (file)
@@ -3906,14 +3906,14 @@ entry_guard_register_connect_status(const char *digest, int succeeded,
   if (! entry_guards)
     return 0;
 
-  SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e,
-    {
-      if (tor_memeq(e->identity, digest, DIGEST_LEN)) {
-        entry = e;
-        idx = e_sl_idx;
-        break;
-      }
-    });
+  SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, e) {
+    tor_assert(e);
+    if (tor_memeq(e->identity, digest, DIGEST_LEN)) {
+      entry = e;
+      idx = e_sl_idx;
+      break;
+    }
+  } SMARTLIST_FOREACH_END(e);
 
   if (!entry)
     return 0;