diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-13 14:00:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-13 14:00:32 +0100 |
commit | 541e688ad1eefea08495c1f92111a6a3db59a66d (patch) | |
tree | e013e0212ef73ae76d1c4dd60205916645865458 /thirdparty/mbedtls/library/entropy.c | |
parent | 8368f53941329c9a1a02f9499b37b79ced31dae1 (diff) | |
parent | 18bc1f2a8f4f5ca4ed11eb174e888b1eb9db2bf5 (diff) |
Merge pull request #46962 from Faless/net/4.x_mbedtls_2.16.10
Bump mbedtls to version 2.16.10.
Diffstat (limited to 'thirdparty/mbedtls/library/entropy.c')
-rw-r--r-- | thirdparty/mbedtls/library/entropy.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/thirdparty/mbedtls/library/entropy.c b/thirdparty/mbedtls/library/entropy.c index 666c55654c..c5f414a010 100644 --- a/thirdparty/mbedtls/library/entropy.c +++ b/thirdparty/mbedtls/library/entropy.c @@ -146,6 +146,11 @@ void mbedtls_entropy_init( mbedtls_entropy_context *ctx ) void mbedtls_entropy_free( mbedtls_entropy_context *ctx ) { + /* If the context was already free, don't call free() again. + * This is important for mutexes which don't allow double-free. */ + if( ctx->accumulator_started == -1 ) + return; + #if defined(MBEDTLS_HAVEGE_C) mbedtls_havege_free( &ctx->havege_data ); #endif @@ -162,7 +167,7 @@ void mbedtls_entropy_free( mbedtls_entropy_context *ctx ) #endif ctx->source_count = 0; mbedtls_platform_zeroize( ctx->source, sizeof( ctx->source ) ); - ctx->accumulator_started = 0; + ctx->accumulator_started = -1; } int mbedtls_entropy_add_source( mbedtls_entropy_context *ctx, |