mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:05:42 +01:00
Merge branch 'iotssl-825-double-free-quickfix'
Conflicts: ChangeLog
This commit is contained in:
commit
df6c3e8e48
@ -34,6 +34,8 @@ Bugfix
|
|||||||
* Fixed the sample applications gen_key.c, cert_req.c and cert_write.c for
|
* Fixed the sample applications gen_key.c, cert_req.c and cert_write.c for
|
||||||
builds where the configuration MBEDTLS_PEM_WRITE_C is not defined. Found
|
builds where the configuration MBEDTLS_PEM_WRITE_C is not defined. Found
|
||||||
by inestlerode. #559.
|
by inestlerode. #559.
|
||||||
|
* Fixed default threading implementation to avoid accidental double
|
||||||
|
initialisations and double frees.
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
* Extended test coverage of special cases, and added new timing test suite.
|
* Extended test coverage of special cases, and added new timing test suite.
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#if defined(MBEDTLS_THREADING_PTHREAD)
|
#if defined(MBEDTLS_THREADING_PTHREAD)
|
||||||
static void threading_mutex_init_pthread( mbedtls_threading_mutex_t *mutex )
|
static void threading_mutex_init_pthread( mbedtls_threading_mutex_t *mutex )
|
||||||
{
|
{
|
||||||
if( mutex == NULL )
|
if( mutex == NULL || mutex->is_valid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mutex->is_valid = pthread_mutex_init( &mutex->mutex, NULL ) == 0;
|
mutex->is_valid = pthread_mutex_init( &mutex->mutex, NULL ) == 0;
|
||||||
@ -40,10 +40,11 @@ static void threading_mutex_init_pthread( mbedtls_threading_mutex_t *mutex )
|
|||||||
|
|
||||||
static void threading_mutex_free_pthread( mbedtls_threading_mutex_t *mutex )
|
static void threading_mutex_free_pthread( mbedtls_threading_mutex_t *mutex )
|
||||||
{
|
{
|
||||||
if( mutex == NULL )
|
if( mutex == NULL || !mutex->is_valid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(void) pthread_mutex_destroy( &mutex->mutex );
|
(void) pthread_mutex_destroy( &mutex->mutex );
|
||||||
|
mutex->is_valid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int threading_mutex_lock_pthread( mbedtls_threading_mutex_t *mutex )
|
static int threading_mutex_lock_pthread( mbedtls_threading_mutex_t *mutex )
|
||||||
|
Loading…
Reference in New Issue
Block a user