diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-07 10:38:24 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-07 10:38:24 -0500 |
commit | 372adfa09a143490dfc058a6e2db78ca27ef9399 (patch) | |
tree | a01dd55e84961d85b1067a6d1c22cd1764ccb0b6 /src/or/connection.c | |
parent | 5990edd1952361faca4619728b50587061d81be7 (diff) | |
parent | a7e946596d6da9aca80456141b7fddbc198c217c (diff) | |
download | tor-372adfa09a143490dfc058a6e2db78ca27ef9399.tar.gz tor-372adfa09a143490dfc058a6e2db78ca27ef9399.zip |
Merge remote-tracking branch 'origin/maint-0.2.4'
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 942bfc598f..0a01e5020c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -540,6 +540,22 @@ connection_free_(connection_t *conn) or_handshake_state_free(or_conn->handshake_state); or_conn->handshake_state = NULL; tor_free(or_conn->nickname); + if (or_conn->chan) { + /* Owww, this shouldn't happen, but... */ + log_info(LD_CHANNEL, + "Freeing orconn at %p, saw channel %p with ID " + U64_FORMAT " left un-NULLed", + or_conn, TLS_CHAN_TO_BASE(or_conn->chan), + U64_PRINTF_ARG( + TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier)); + if (!(TLS_CHAN_TO_BASE(or_conn->chan)->state == CHANNEL_STATE_CLOSED || + TLS_CHAN_TO_BASE(or_conn->chan)->state == CHANNEL_STATE_ERROR)) { + channel_close_for_error(TLS_CHAN_TO_BASE(or_conn->chan)); + } + + or_conn->chan->conn = NULL; + or_conn->chan = NULL; + } } if (conn->type == CONN_TYPE_AP) { entry_connection_t *entry_conn = TO_ENTRY_CONN(conn); |