Cleaned up location of init and free for some programs to prevent memory
leaks on incorrect arguments
diff --git a/programs/pkey/pk_sign.c b/programs/pkey/pk_sign.c
index 67ac0b4..4adb753 100644
--- a/programs/pkey/pk_sign.c
+++ b/programs/pkey/pk_sign.c
@@ -58,7 +58,7 @@
 int main( int argc, char *argv[] )
 {
     FILE *f;
-    int ret;
+    int ret = 1;
     pk_context pk;
     entropy_context entropy;
     ctr_drbg_context ctr_drbg;
@@ -68,7 +68,8 @@
     const char *pers = "pk_sign";
     size_t olen = 0;
 
-    ret = 1;
+    entropy_init( &entropy );
+    pk_init( &pk );
 
     if( argc != 3 )
     {
@@ -84,7 +85,6 @@
     printf( "\n  . Seeding the random number generator..." );
     fflush( stdout );
 
-    entropy_init( &entropy );
     if( ( ret = ctr_drbg_init( &ctr_drbg, entropy_func, &entropy,
                                (const unsigned char *) pers,
                                strlen( pers ) ) ) != 0 )
@@ -96,8 +96,6 @@
     printf( "\n  . Reading private key from '%s'", argv[1] );
     fflush( stdout );
 
-    pk_init( &pk );
-
     if( ( ret = pk_parse_keyfile( &pk, argv[1], "" ) ) != 0 )
     {
         ret = 1;