summaryrefslogtreecommitdiff
path: root/src/or/channeltls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-30 11:12:58 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-11 10:10:29 -0400
commit4f8086fb20e93c477f033f58da17aa31b9c29fd6 (patch)
treecc6d6fb5cc6d7852f82295aa92c87d7068df1271 /src/or/channeltls.c
parent55b5e0076fbd22a78ef2297ccb3a81bf03c42924 (diff)
downloadtor-4f8086fb20e93c477f033f58da17aa31b9c29fd6.tar.gz
tor-4f8086fb20e93c477f033f58da17aa31b9c29fd6.zip
Enable -Wnull-dereference (GCC >=6.1), and fix the easy cases
This warning, IIUC, means that the compiler doesn't like it when it sees a NULL check _after_ we've already dereferenced the variable. In such cases, it considers itself free to eliminate the NULL check. There are a couple of tricky cases: One was the case related to the fact that tor_addr_to_in6() can return NULL if it gets a non-AF_INET6 address. The fix was to create a variant which asserts on the address type, and never returns NULL.
Diffstat (limited to 'src/or/channeltls.c')
-rw-r--r--src/or/channeltls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 2128b0924d..293f01070b 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -797,6 +797,7 @@ static int
channel_tls_write_packed_cell_method(channel_t *chan,
packed_cell_t *packed_cell)
{
+ tor_assert(chan);
channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
size_t cell_network_size = get_cell_network_size(chan->wide_circ_ids);
int written = 0;