mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-10-30 10:45:34 +03:00 
			
		
		
		
	Lock test mutex before doing mutex usage check
Although this again should only happen post all threads stopping, guard this just in case things change. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
		| @@ -317,6 +317,7 @@ void mbedtls_test_mutex_usage_init(void) | |||||||
|  |  | ||||||
| void mbedtls_test_mutex_usage_check(void) | void mbedtls_test_mutex_usage_check(void) | ||||||
| { | { | ||||||
|  |     if (mutex_functions.lock(&mbedtls_test_mutex_mutex) == 0) { | ||||||
|         if (live_mutexes != 0) { |         if (live_mutexes != 0) { | ||||||
|             /* A positive number (more init than free) means that a mutex resource |             /* A positive number (more init than free) means that a mutex resource | ||||||
|              * is leaking (on platforms where a mutex consumes more than the |              * is leaking (on platforms where a mutex consumes more than the | ||||||
| @@ -333,6 +334,9 @@ void mbedtls_test_mutex_usage_check(void) | |||||||
|             mbedtls_test_fail("Mutex usage error", __LINE__, __FILE__); |             mbedtls_test_fail("Mutex usage error", __LINE__, __FILE__); | ||||||
|         } |         } | ||||||
|         mbedtls_test_set_mutex_usage_error(NULL); |         mbedtls_test_set_mutex_usage_error(NULL); | ||||||
|  |  | ||||||
|  |         mutex_functions.unlock(&mbedtls_test_mutex_mutex); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void mbedtls_test_mutex_usage_end(void) | void mbedtls_test_mutex_usage_end(void) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user