aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitmux.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-02 11:55:53 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-02 11:56:56 -0400
commitefcab439564dcadc5bc14609a9205d73d236e966 (patch)
tree32b90aeed52b5d76bb862bd824b16bf0e2c7829a /src/or/circuitmux.c
parent8139db372528ca02cd572f3f7848e9d174a9b12e (diff)
downloadtor-efcab439564dcadc5bc14609a9205d73d236e966.tar.gz
tor-efcab439564dcadc5bc14609a9205d73d236e966.zip
Fix a number of clang analyzer false-positives
Most of these are in somewhat non-obvious code where it is probably a good idea to initialize variables and add extra assertions anyway. Closes 13036. Patches from "teor".
Diffstat (limited to 'src/or/circuitmux.c')
-rw-r--r--src/or/circuitmux.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 55580d5c29..e4571ff944 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -1092,8 +1092,11 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ))
/*
* Use this to keep track of whether we found it for n_chan or
* p_chan for consistency checking.
+ *
+ * The 0 initializer is not a valid cell_direction_t value.
+ * We assert that it has been replaced with a valid value before it is used.
*/
- cell_direction_t last_searched_direction;
+ cell_direction_t last_searched_direction = 0;
tor_assert(cmux);
tor_assert(cmux->chanid_circid_map);
@@ -1123,6 +1126,9 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ))
}
}
+ tor_assert(last_searched_direction == CELL_DIRECTION_OUT
+ || last_searched_direction == CELL_DIRECTION_IN);
+
/*
* If hashent isn't NULL, we have a circuit to detach; don't remove it from
* the map until later of circuitmux_make_circuit_inactive() breaks.