summaryrefslogtreecommitdiffstats
path: root/crypto/mem_dbg.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-12-15 16:40:35 +0000
committerBodo Möller <bodo@openssl.org>2000-12-15 16:40:35 +0000
commit3ac82faae5eb02140f347610be0726f549a0aa0a (patch)
tree66436fe17f2753bb728a1455a5d8763b6c00c5d3 /crypto/mem_dbg.c
parentc08523d862276964e65d6a1de07439b9d0c2a6da (diff)
Locking issues.
Diffstat (limited to 'crypto/mem_dbg.c')
-rw-r--r--crypto/mem_dbg.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c
index 9ed8184e45..a6c70e431a 100644
--- a/crypto/mem_dbg.c
+++ b/crypto/mem_dbg.c
@@ -678,7 +678,15 @@ void CRYPTO_mem_leaks(BIO *b)
* void_fn_to_char kludge in CRYPTO_mem_leaks_cb.
* Otherwise the code police will come and get us.)
*/
+ int old_mh_mode;
+
CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
+
+ /* avoid deadlock when lh_free() uses CRYPTO_dbg_free(),
+ * which uses CRYPTO_is_mem_check_on */
+ old_mh_mode = mh_mode;
+ mh_mode = CRYPTO_MEM_CHECK_OFF;
+
if (mh != NULL)
{
lh_free(mh);
@@ -692,6 +700,8 @@ void CRYPTO_mem_leaks(BIO *b)
amih = NULL;
}
}
+
+ mh_mode = old_mh_mode;
CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
}
MemCheck_on(); /* releases CRYPTO_LOCK_MALLOC2 */