diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 972ad2aea..e2f45c78a 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -67,7 +67,10 @@ int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len } if( CryptGenRandom( provider, (DWORD) len, output ) == FALSE ) + { + CryptReleaseContext( provider, 0 ); return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED ); + } CryptReleaseContext( provider, 0 ); *olen = len;