3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 13:06:05 +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

@ -35,7 +35,7 @@ out_of_memory_error::out_of_memory_error():z3_error(ERR_MEMOUT) {
}
static DECLARE_MUTEX(g_memory_mux);
static DECLARE_INIT_MUTEX(g_memory_mux);
static atomic<bool> g_memory_out_of_memory(false);
static bool g_memory_initialized = false;
static long long g_memory_alloc_size = 0;
@ -134,7 +134,9 @@ void memory::finalize() {
if (g_memory_initialized) {
g_finalizing = true;
mem_finalize();
delete g_memory_mux;
// we leak the mutex since we need it to be always live since memory may
// be reinitialized again
//delete g_memory_mux;
g_memory_initialized = false;
g_finalizing = false;
}