From e9af9e3e120a4361f13212d8d89a7abf21f53ea7 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Tue, 25 Oct 2022 10:32:08 +0100 Subject: [PATCH] Minor improvements to ecp.c changes Signed-off-by: David Horstmann --- library/ecp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/ecp.c b/library/ecp.c index 48c2403d42..83df037624 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -2395,12 +2395,12 @@ cleanup: mbedtls_free( T ); } - int should_free_R = 0; /* prevent caller from using invalid value */ - should_free_R = ( ret != 0 ); + int should_free_R = ( ret != 0 ); #if defined(MBEDTLS_ECP_RESTARTABLE) /* don't free R while in progress in case R == P */ - should_free_R = should_free_R && ( ret != MBEDTLS_ERR_ECP_IN_PROGRESS ); + if( ret == MBEDTLS_ERR_ECP_IN_PROGRESS ) + should_free_R = 0; #endif if( should_free_R ) mbedtls_ecp_point_free( R );