3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

fix mutexes hanging due to access to free'd memory

Thanks to Kevin de Vos for reporting the bug & testing the fix
This commit is contained in:
Nuno Lopes 2019-09-03 20:02:21 +01:00
parent cb75326686
commit 87a96d7bd4
8 changed files with 27 additions and 8 deletions

View file

@ -63,6 +63,7 @@ void finalize_inf_int_rational();
void rational::initialize() {
if (!g_mpq_manager) {
ALLOC_MUTEX(g_powers_of_two);
g_mpq_manager = alloc(synch_mpq_manager);
m().set(m_zero.m_val, 0);
m().set(m_one.m_val, 1);
@ -81,6 +82,6 @@ void rational::finalize() {
m_minus_one.~rational();
dealloc(g_mpq_manager);
g_mpq_manager = nullptr;
delete g_powers_of_two;
DEALLOC_MUTEX(g_powers_of_two);
}