summaryrefslogtreecommitdiff
path: root/win32/winutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/winutil.c')
-rw-r--r--win32/winutil.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/win32/winutil.c b/win32/winutil.c
index c3e668b..878e95c 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);