mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-19 12:08:00 -04:00
Fix resource leaks
These potential leaks were flagged by the Coverity static analyzer. Signed-off-by: Leonid Rozenboim <leonid.rozenboim@oracle.com>
This commit is contained in:
parent
a16d8fcee9
commit
763ee3c6b4
@ -1465,8 +1465,10 @@ int mbedtls_pk_parse_public_key( mbedtls_pk_context *ctx,
|
|||||||
if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
|
if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
|
||||||
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 );
|
||||||
return( ret );
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ( ret = pk_get_rsapubkey( &p, p + pem.buflen, mbedtls_pk_rsa( *ctx ) ) ) != 0 )
|
if ( ( ret = pk_get_rsapubkey( &p, p + pem.buflen, mbedtls_pk_rsa( *ctx ) ) ) != 0 )
|
||||||
mbedtls_pk_free( ctx );
|
mbedtls_pk_free( ctx );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user