Cleaned up location of init and free for some programs to prevent memory
leaks on incorrect arguments
diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c
index b41bcf8..0969a5a 100644
--- a/programs/pkey/rsa_verify_pss.c
+++ b/programs/pkey/rsa_verify_pss.c
@@ -55,14 +55,15 @@
int main( int argc, char *argv[] )
{
FILE *f;
- int ret;
+ int ret = 1;
size_t i;
pk_context pk;
unsigned char hash[20];
unsigned char buf[POLARSSL_MPI_MAX_SIZE];
char filename[512];
- ret = 1;
+ pk_init( &pk );
+
if( argc != 3 )
{
printf( "usage: rsa_verify_pss <key_file> <filename>\n" );
@@ -77,8 +78,6 @@
printf( "\n . Reading public key from '%s'", argv[1] );
fflush( stdout );
- pk_init( &pk );
-
if( ( ret = pk_parse_public_keyfile( &pk, argv[1] ) ) != 0 )
{
printf( " failed\n ! Could not read key from '%s'\n", argv[1] );