mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Try a little harder to avoid openssl SSL* double-free reports.
svn:r3710
This commit is contained in:
parent
0a2be3c9d8
commit
97bc49bd72
3 changed files with 7 additions and 3 deletions
|
@ -436,8 +436,10 @@ tor_tls_new(int sock, int isServer, int use_no_cert)
|
||||||
void
|
void
|
||||||
tor_tls_free(tor_tls *tls)
|
tor_tls_free(tor_tls *tls)
|
||||||
{
|
{
|
||||||
|
tor_assert(tls && tls->ssl);
|
||||||
SSL_free(tls->ssl);
|
SSL_free(tls->ssl);
|
||||||
free(tls);
|
tls->ssl = NULL;
|
||||||
|
tor_free(tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Underlying function for TLS reading. Reads up to <b>len</b>
|
/** Underlying function for TLS reading. Reads up to <b>len</b>
|
||||||
|
|
|
@ -170,8 +170,10 @@ _connection_free(connection_t *conn) {
|
||||||
if (connection_speaks_cells(conn)) {
|
if (connection_speaks_cells(conn)) {
|
||||||
if (conn->state == OR_CONN_STATE_OPEN)
|
if (conn->state == OR_CONN_STATE_OPEN)
|
||||||
directory_set_dirty();
|
directory_set_dirty();
|
||||||
if (conn->tls)
|
if (conn->tls) {
|
||||||
tor_tls_free(conn->tls);
|
tor_tls_free(conn->tls);
|
||||||
|
conn->tls = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->identity_pkey)
|
if (conn->identity_pkey)
|
||||||
|
|
|
@ -1276,10 +1276,10 @@ void tor_cleanup(void) {
|
||||||
* unlink, nothing we could do about it anyways. */
|
* unlink, nothing we could do about it anyways. */
|
||||||
if (options->PidFile && options->command == CMD_RUN_TOR)
|
if (options->PidFile && options->command == CMD_RUN_TOR)
|
||||||
unlink(options->PidFile);
|
unlink(options->PidFile);
|
||||||
crypto_global_cleanup();
|
|
||||||
if (accounting_is_enabled(options))
|
if (accounting_is_enabled(options))
|
||||||
accounting_record_bandwidth_usage(time(NULL));
|
accounting_record_bandwidth_usage(time(NULL));
|
||||||
tor_free_all(); /* move tor_free_all back into the ifdef below later. XXX*/
|
tor_free_all(); /* move tor_free_all back into the ifdef below later. XXX*/
|
||||||
|
crypto_global_cleanup();
|
||||||
#ifdef USE_DMALLOC
|
#ifdef USE_DMALLOC
|
||||||
dmalloc_log_unfreed();
|
dmalloc_log_unfreed();
|
||||||
dmalloc_shutdown();
|
dmalloc_shutdown();
|
||||||
|
|
Loading…
Add table
Reference in a new issue