Add missing calls to pem_free in pk_parse

This commit is contained in:
Hanno Becker 2017-09-28 16:48:04 +01:00
parent 713c9e187f
commit b299a37a72

View file

@ -1068,7 +1068,10 @@ int pk_parse_key( pk_context *pk,
if( ret == 0 )
{
if( ( pk_info = pk_info_from_type( POLARSSL_PK_RSA ) ) == NULL )
{
pem_free( &pem );
return( POLARSSL_ERR_PK_UNKNOWN_PK_ALG );
}
if( ( ret = pk_init_ctx( pk, pk_info ) ) != 0 ||
( ret = pk_parse_key_pkcs1_der( pk_rsa( *pk ),
@ -1096,7 +1099,10 @@ int pk_parse_key( pk_context *pk,
if( ret == 0 )
{
if( ( pk_info = pk_info_from_type( POLARSSL_PK_ECKEY ) ) == NULL )
{
pem_free( &pem );
return( POLARSSL_ERR_PK_UNKNOWN_PK_ALG );
}
if( ( ret = pk_init_ctx( pk, pk_info ) ) != 0 ||
( ret = pk_parse_key_sec1_der( pk_ec( *pk ),