mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 15:32:58 +00:00
Prevent resource leak
If -f was used as an argument twice to the program, then it would leak the file resource, due to overwriting it on the second pass Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
c38c1f2411
commit
3820c150d1
@ -219,7 +219,13 @@ void parse_arguments( int argc, char *argv[] )
|
|||||||
error_exit();
|
error_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( b64_file = fopen( argv[i], "r" ) ) == NULL )
|
if( NULL != b64_file )
|
||||||
|
{
|
||||||
|
printf_err( "Cannot specify more than one file with -f\n" );
|
||||||
|
error_exit( );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( b64_file = fopen( argv[i], "r" )) == NULL )
|
||||||
{
|
{
|
||||||
printf_err( "Cannot find file \"%s\"\n", argv[i] );
|
printf_err( "Cannot find file \"%s\"\n", argv[i] );
|
||||||
error_exit();
|
error_exit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user