diff options
author | milo <milo@r0ot.me> | 2011-03-09 13:46:30 +0100 |
---|---|---|
committer | milo <milo@r0ot.me> | 2011-04-14 14:05:44 +0200 |
commit | c5db7674ec1a6ce05a10f1efee3d64ec636c0026 (patch) | |
tree | 74535f560a1d50909a45cea59c47dab6ada4fed9 /src | |
parent | 269485397953ae588b130219138ae07d17d14034 (diff) | |
download | libssh-c5db7674ec1a6ce05a10f1efee3d64ec636c0026.tar.gz libssh-c5db7674ec1a6ce05a10f1efee3d64ec636c0026.tar.xz libssh-c5db7674ec1a6ce05a10f1efee3d64ec636c0026.zip |
[pki] check for NULL and small cosmetic changes
Diffstat (limited to 'src')
-rw-r--r-- | src/pki.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -53,18 +53,18 @@ ssh_key ssh_key_new (void) { * @param[in] key ssh_key to clean */ void ssh_key_clean (ssh_key key){ - if(key==NULL) - return; + if(key == NULL) + return; #ifdef HAVE_LIBGCRYPT - gcry_sexp_release(key->dsa); - gcry_sexp_release(key->rsa); + if(key->dsa) gcry_sexp_release(key->dsa); + if(key->rsa) gcry_sexp_release(key->rsa); #elif defined HAVE_LIBCRYPTO - DSA_free(key->dsa); - RSA_free(key->rsa); + if(key->dsa) DSA_free(key->dsa); + if(key->rsa) RSA_free(key->rsa); #endif - key->flags=SSH_KEY_FLAG_EMPTY; - key->type=SSH_KEYTYPE_UNKNOWN; - key->type_c=NULL; + key->flags=SSH_KEY_FLAG_EMPTY; + key->type=SSH_KEYTYPE_UNKNOWN; + key->type_c=NULL; } /** @@ -72,10 +72,10 @@ void ssh_key_clean (ssh_key key){ * @param[in] key ssh_key handle to free */ void ssh_key_free (ssh_key key){ - if(key){ - ssh_key_clean(key); - SAFE_FREE(key); - } + if(key){ + ssh_key_clean(key); + SAFE_FREE(key); + } } /** @@ -85,9 +85,10 @@ void ssh_key_free (ssh_key key){ * @returns SSH_KEYTYPE_UNKNOWN if the type is unknown */ enum ssh_keytypes_e ssh_key_type(ssh_key key){ - if (key==NULL) - return SSH_KEYTYPE_UNKNOWN; - return key->type; + if (key == NULL) { + return SSH_KEYTYPE_UNKNOWN; + } + return key->type; } /** |