mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-02 07:20:26 +00:00
Add pem_free() to other error paths in pk_parse_public_key()
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
56e01f37a8
commit
072d2b094d
@ -1453,10 +1453,14 @@ int mbedtls_pk_parse_public_key( mbedtls_pk_context *ctx,
|
|||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
{
|
||||||
p = pem.buf;
|
p = pem.buf;
|
||||||
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( ctx, pk_info ) ) != 0 ) {
|
if( ( ret = mbedtls_pk_setup( ctx, pk_info ) ) != 0 )
|
||||||
|
{
|
||||||
mbedtls_pem_free( &pem );
|
mbedtls_pem_free( &pem );
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user