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/app | |
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/app')
-rw-r--r-- | src/app/config/config.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index 0b1b758d96..2416da2b26 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -1187,7 +1187,11 @@ init_protocol_warning_severity_level(void) static void cleanup_protocol_warning_severity_level(void) { - atomic_counter_destroy(&protocol_warning_severity_level); + /* 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. */ + atomic_counter_destroy(&protocol_warning_severity_level); } /** List of default directory authorities */ |