mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-25 04:43:31 +01:00
Use tor_tls_release_socket() to avoid double-closed sockets on NSS
Closes ticket 27451; bug not in any released Tor.
This commit is contained in:
parent
ae5692994f
commit
9f5f67bda2
@ -638,8 +638,19 @@ connection_free_minimal(connection_t *conn)
|
|||||||
|
|
||||||
if (connection_speaks_cells(conn)) {
|
if (connection_speaks_cells(conn)) {
|
||||||
or_connection_t *or_conn = TO_OR_CONN(conn);
|
or_connection_t *or_conn = TO_OR_CONN(conn);
|
||||||
tor_tls_free(or_conn->tls);
|
if (or_conn->tls) {
|
||||||
or_conn->tls = NULL;
|
if (! SOCKET_OK(conn->s)) {
|
||||||
|
/* The socket has been closed by somebody else; we must tell the
|
||||||
|
* TLS object not to close it. */
|
||||||
|
tor_tls_release_socket(or_conn->tls);
|
||||||
|
} else {
|
||||||
|
/* The tor_tls_free() call below will close the socket; we must tell
|
||||||
|
* the code below not to close it a second time. */
|
||||||
|
conn->s = TOR_INVALID_SOCKET;
|
||||||
|
}
|
||||||
|
tor_tls_free(or_conn->tls);
|
||||||
|
or_conn->tls = NULL;
|
||||||
|
}
|
||||||
or_handshake_state_free(or_conn->handshake_state);
|
or_handshake_state_free(or_conn->handshake_state);
|
||||||
or_conn->handshake_state = NULL;
|
or_conn->handshake_state = NULL;
|
||||||
tor_free(or_conn->nickname);
|
tor_free(or_conn->nickname);
|
||||||
|
Loading…
Reference in New Issue
Block a user