Clear pk context and other minor changes in *_free() procedures
diff --git a/library/pk.c b/library/pk.c
index f05b139..08e9b44 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -61,10 +61,11 @@
  */
 void mbedtls_pk_free( mbedtls_pk_context *ctx )
 {
-    if( ctx == NULL || ctx->pk_info == NULL )
+    if( ctx == NULL )
         return;
 
-    ctx->pk_info->ctx_free_func( ctx->pk_ctx );
+    if ( ctx->pk_info != NULL )
+        ctx->pk_info->ctx_free_func( ctx->pk_ctx );
 
     mbedtls_platform_zeroize( ctx, sizeof( mbedtls_pk_context ) );
 }