From 1e462057cdcb82c57c18dbb45ca21893def6ac56 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Fri, 27 Jan 2012 10:56:33 +0000 Subject: [PATCH] - fix #60895, possible invalid handler usage --- win32/winutil.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/win32/winutil.c b/win32/winutil.c index 1e8bf0bedb5..d9609f7987e 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -62,8 +62,10 @@ void php_win32_init_rng_lock() void php_win32_free_rng_lock() { tsrm_mutex_lock(php_lock_win32_cryptoctx); - CryptReleaseContext(hCryptProv, 0); - has_crypto_ctx = 0; + if (has_crypto_ctx == 1) { + CryptReleaseContext(hCryptProv, 0); + has_crypto_ctx = 0; + } tsrm_mutex_unlock(php_lock_win32_cryptoctx); tsrm_mutex_free(php_lock_win32_cryptoctx);