aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-04-18 20:33:47 -0400
committerNick Mathewson <nickm@torproject.org>2014-04-18 20:35:59 -0400
commit710649257176a35b28c0ca5f2b823d39e011350c (patch)
treeadd2e6e579cef5d33d7a4362c84d823651d5d92a /src
parent69ea4450caee65be56912fd2618c2b95413a0763 (diff)
downloadtor-710649257176a35b28c0ca5f2b823d39e011350c.tar
tor-710649257176a35b28c0ca5f2b823d39e011350c.tar.gz
scan-build: Be consistent with a needless check in circuitmux.c
In circuitmux_detach_all_circuits, we check whether an HT iterator gives us NULL. That should be impossible for an HT iterator. But our checking it has confused scan-build (justly) into thinking that our later use of HT_NEXT_RMV might not be kosher. I'm taking the coward's route here and strengthening the check. Bugfix on fd31dd44. (Not a real bug though)
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitmux.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 2d05c748e..52ebfef08 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -412,7 +412,11 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
i = HT_START(chanid_circid_muxinfo_map, cmux->chanid_circid_map);
while (i) {
to_remove = *i;
- if (to_remove) {
+
+ if (! to_remove) {
+ log_warn(LD_BUG, "Somehow, an HT iterator gave us a NULL pointer.");
+ break;
+ } else {
/* Find a channel and circuit */
chan = channel_find_by_global_id(to_remove->chan_id);
if (chan) {