mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 18:54:20 +01:00
Add missing calls to mbedtls_pem_free in mbedtls_pk_parse
This commit is contained in:
parent
ab0a8042f4
commit
771d30edac
@ -1082,7 +1082,10 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
|
|||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
{
|
||||||
if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
|
if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
|
||||||
|
{
|
||||||
|
mbedtls_pem_free( &pem );
|
||||||
return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
|
return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
|
||||||
|
}
|
||||||
|
|
||||||
if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 ||
|
if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 ||
|
||||||
( ret = pk_parse_key_pkcs1_der( mbedtls_pk_rsa( *pk ),
|
( ret = pk_parse_key_pkcs1_der( mbedtls_pk_rsa( *pk ),
|
||||||
@ -1114,7 +1117,10 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
|
|||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
{
|
||||||
if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY ) ) == NULL )
|
if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY ) ) == NULL )
|
||||||
|
{
|
||||||
|
mbedtls_pem_free( &pem );
|
||||||
return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
|
return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
|
||||||
|
}
|
||||||
|
|
||||||
if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 ||
|
if( ( ret = mbedtls_pk_setup( pk, pk_info ) ) != 0 ||
|
||||||
( ret = pk_parse_key_sec1_der( mbedtls_pk_ec( *pk ),
|
( ret = pk_parse_key_sec1_der( mbedtls_pk_ec( *pk ),
|
||||||
|
Loading…
Reference in New Issue
Block a user