Fix possible fd leak in test file

This commit is contained in:
Manuel Pégourié-Gonnard 2015-02-14 16:01:34 +00:00
parent 401caadebd
commit e43187d59d

View file

@ -97,6 +97,7 @@ void mpi_read_file( int radix_X, char *input_file, char *input_A,
unsigned char buf[1000]; unsigned char buf[1000];
size_t buflen; size_t buflen;
FILE *file; FILE *file;
int ret;
memset( buf, 0x00, 1000 ); memset( buf, 0x00, 1000 );
memset( str, 0x00, 1000 ); memset( str, 0x00, 1000 );
@ -105,8 +106,9 @@ void mpi_read_file( int radix_X, char *input_file, char *input_A,
file = fopen( input_file, "r" ); file = fopen( input_file, "r" );
TEST_ASSERT( file != NULL ); TEST_ASSERT( file != NULL );
TEST_ASSERT( mpi_read_file( &X, radix_X, file ) == result ); ret = mpi_read_file( &X, radix_X, file );
fclose(file); fclose(file);
TEST_ASSERT( ret == result );
if( result == 0 ) if( result == 0 )
{ {