From d19ea90f11c657db2c1a4232a40c460eb1a92400 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 26 Jan 2016 11:39:26 +0100 Subject: [PATCH] Fix handle leak in mbedtls_platform_entropy_poll() on Windows on error --- library/entropy_poll.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 25a27bef3..01bd58efc 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -61,7 +61,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;