summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshkey.c
diff options
context:
space:
mode:
authormmcc <mmcc@openbsd.org>2015-12-11 04:21:11 +0000
committermmcc <mmcc@openbsd.org>2015-12-11 04:21:11 +0000
commit860b88215344f81dabc73da83bc869b3f57892bd (patch)
treebe24ac75ef63ad3efc85a90e3e49e6ce02b21231 /usr.bin/ssh/sshkey.c
parentinclude remote port number in a few more messages; makes tying log (diff)
downloadwireguard-openbsd-860b88215344f81dabc73da83bc869b3f57892bd.tar.xz
wireguard-openbsd-860b88215344f81dabc73da83bc869b3f57892bd.zip
Remove NULL-checks before sshbuf_free().
ok djm@
Diffstat (limited to 'usr.bin/ssh/sshkey.c')
-rw-r--r--usr.bin/ssh/sshkey.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c
index e5500268893..9c0674d9e50 100644
--- a/usr.bin/ssh/sshkey.c
+++ b/usr.bin/ssh/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.30 2015/12/11 02:31:47 mmcc Exp $ */
+/* $OpenBSD: sshkey.c,v 1.31 2015/12/11 04:21:12 mmcc Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -400,12 +400,9 @@ cert_free(struct sshkey_cert *cert)
if (cert == NULL)
return;
- if (cert->certblob != NULL)
- sshbuf_free(cert->certblob);
- if (cert->critical != NULL)
- sshbuf_free(cert->critical);
- if (cert->extensions != NULL)
- sshbuf_free(cert->extensions);
+ sshbuf_free(cert->certblob);
+ sshbuf_free(cert->critical);
+ sshbuf_free(cert->extensions);
free(cert->key_id);
for (i = 0; i < cert->nprincipals; i++)
free(cert->principals[i]);
@@ -2426,8 +2423,7 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
sshbuf_reset(cert);
free(sig_blob);
free(ca_blob);
- if (principals != NULL)
- sshbuf_free(principals);
+ sshbuf_free(principals);
return ret;
}
@@ -3437,10 +3433,8 @@ sshkey_private_rsa1_to_blob(struct sshkey *key, struct sshbuf *blob,
out:
explicit_bzero(&ciphercontext, sizeof(ciphercontext));
explicit_bzero(buf, sizeof(buf));
- if (buffer != NULL)
- sshbuf_free(buffer);
- if (encrypted != NULL)
- sshbuf_free(encrypted);
+ sshbuf_free(buffer);
+ sshbuf_free(encrypted);
return r;
}
@@ -3588,8 +3582,7 @@ sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
pub = NULL;
out:
- if (copy != NULL)
- sshbuf_free(copy);
+ sshbuf_free(copy);
sshkey_free(pub);
return r;
}
@@ -3704,10 +3697,8 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
explicit_bzero(&ciphercontext, sizeof(ciphercontext));
free(comment);
sshkey_free(prv);
- if (copy != NULL)
- sshbuf_free(copy);
- if (decrypted != NULL)
- sshbuf_free(decrypted);
+ sshbuf_free(copy);
+ sshbuf_free(decrypted);
return r;
}
#endif /* WITH_SSH1 */