aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-01-11 12:45:25 -0500
committerNick Mathewson <nickm@torproject.org>2018-01-11 12:45:25 -0500
commit05ac3d0458466bd8ffc69339a4bf8e34088d9d80 (patch)
tree18741abb304de4419862314d9da2fa40aec900c4 /src/common
parent751595551afb6282d952c482a11db35daf3736ab (diff)
parent3b465ebf2eedecfa0659f91a6ed7dc667e7acde7 (diff)
downloadtor-05ac3d0458466bd8ffc69339a4bf8e34088d9d80.tar.gz
tor-05ac3d0458466bd8ffc69339a4bf8e34088d9d80.zip
Merge branch 'restart_nocrash'
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat_libevent.c10
-rw-r--r--src/common/compat_libevent.h1
-rw-r--r--src/common/crypto.c2
3 files changed, 13 insertions, 0 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 10489bf296..b5e9cc9332 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -237,6 +237,16 @@ tor_init_libevent_rng(void)
return rv;
}
+/**
+ * Un-initialize libevent in preparation for an exit
+ */
+void
+tor_libevent_free_all(void)
+{
+ event_base_free(the_event_base);
+ the_event_base = NULL;
+}
+
#if defined(LIBEVENT_VERSION_NUMBER) && \
LIBEVENT_VERSION_NUMBER >= V(2,1,1) && \
!defined(TOR_UNIT_TESTS)
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 0cdb73fbb9..1853e50917 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -52,6 +52,7 @@ const char *tor_libevent_get_method(void);
void tor_check_libevent_header_compatibility(void);
const char *tor_libevent_get_version_str(void);
const char *tor_libevent_get_header_version_str(void);
+void tor_libevent_free_all(void);
int tor_init_libevent_rng(void);
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 4faf7c6838..85bed538e5 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -3470,6 +3470,8 @@ crypto_global_cleanup(void)
if (dh_param_g)
BN_clear_free(dh_param_g);
+ dh_param_p = dh_param_p_tls = dh_param_g = NULL;
+
#ifndef DISABLE_ENGINES
ENGINE_cleanup();
#endif