Commit 2fb0c899 authored by Bodo Möller's avatar Bodo Möller
Browse files

Include CRYPTO_mem_leaks deadlock fix.

parent 73bc0cfd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@
     [Bodo Moeller, Geoff Thorpe; original patch submitted by
     "Reddie, Steven" <Steven.Reddie@ca.com>]

  *) Fix a deadlock in CRYPTO_mem_leaks().
     [Bodo Moeller]

  *) rand_win.c fix for Borland C.
     [Ulf Möller]
 
+10 −0
Original line number Diff line number Diff line
@@ -671,7 +671,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);
@@ -685,6 +693,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 */