Avoid fclose( NULL )

Found by Coverity Scan.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-24 00:09:29 +02:00
parent 7f9049baf4
commit bcc030849a

View file

@ -284,13 +284,10 @@ int mbedtls_md_file( const mbedtls_md_info_t *md_info, const char *path, unsigne
if( md_info == NULL )
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
mbedtls_md_init( &ctx );
if( ( f = fopen( path, "rb" ) ) == NULL )
{
ret = MBEDTLS_ERR_MD_FILE_IO_ERROR;
goto cleanup;
}
return( MBEDTLS_ERR_MD_FILE_IO_ERROR );
mbedtls_md_init( &ctx );
if( ( ret = mbedtls_md_setup( &ctx, md_info, 0 ) ) != 0 )
goto cleanup;