diff options
author | teor <teor@torproject.org> | 2019-09-20 11:27:05 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-09-26 12:37:25 +1000 |
commit | d1eab05834566f998721d3a16107767885711c57 (patch) | |
tree | 4224a8adc04fd130a8794f18e3bd8d54c82d87e8 /src/feature | |
parent | 02840169d860384257042bdf6d7601c2bf48b47b (diff) | |
download | tor-d1eab05834566f998721d3a16107767885711c57.tar.gz tor-d1eab05834566f998721d3a16107767885711c57.zip |
lock: Avoid some undefined behaviour when freeing mutexes.
Fixes bug 31736; bugfix on 0.0.7.
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/relay/router.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index dad2c6a50f..af47e79d28 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -3072,6 +3072,10 @@ router_free_all(void) crypto_pk_free(server_identitykey); crypto_pk_free(client_identitykey); + /* Destroying a locked mutex is undefined behaviour. This mutex may be + * locked, because multiple threads can access it. But we need to destroy + * it, otherwise re-initialisation will trigger undefined behaviour. + * See #31735 for details. */ tor_mutex_free(key_lock); routerinfo_free(desc_routerinfo); extrainfo_free(desc_extrainfo); |