summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshkey.c
diff options
context:
space:
mode:
authormmcc <mmcc@openbsd.org>2015-12-10 17:08:40 +0000
committermmcc <mmcc@openbsd.org>2015-12-10 17:08:40 +0000
commit1b895242ce0e7b0bb67e09a5f50eb9e279005ed7 (patch)
tree671497ed555e2ccf32a2feb5783adf0518e53434 /usr.bin/ssh/sshkey.c
parentMap SOCKS error codes to error strings. With input from deraadt@ (diff)
downloadwireguard-openbsd-1b895242ce0e7b0bb67e09a5f50eb9e279005ed7.tar.xz
wireguard-openbsd-1b895242ce0e7b0bb67e09a5f50eb9e279005ed7.zip
Remove NULL-checks before free().
ok dtucker@
Diffstat (limited to 'usr.bin/ssh/sshkey.c')
-rw-r--r--usr.bin/ssh/sshkey.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c
index 626acf2f1f8..edf0fa43162 100644
--- a/usr.bin/ssh/sshkey.c
+++ b/usr.bin/ssh/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.28 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: sshkey.c,v 1.29 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -406,12 +406,10 @@ cert_free(struct sshkey_cert *cert)
sshbuf_free(cert->critical);
if (cert->extensions != NULL)
sshbuf_free(cert->extensions);
- if (cert->key_id != NULL)
- free(cert->key_id);
+ free(cert->key_id);
for (i = 0; i < cert->nprincipals; i++)
free(cert->principals[i]);
- if (cert->principals != NULL)
- free(cert->principals);
+ free(cert->principals);
if (cert->signature_key != NULL)
sshkey_free(cert->signature_key);
explicit_bzero(cert, sizeof(*cert));
@@ -2427,10 +2425,8 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
out:
if (ret != 0)
sshbuf_reset(cert);
- if (sig_blob != NULL)
- free(sig_blob);
- if (ca_blob != NULL)
- free(ca_blob);
+ free(sig_blob);
+ free(ca_blob);
if (principals != NULL)
sshbuf_free(principals);
return ret;
@@ -3708,8 +3704,7 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
}
out:
explicit_bzero(&ciphercontext, sizeof(ciphercontext));
- if (comment != NULL)
- free(comment);
+ free(comment);
if (prv != NULL)
sshkey_free(prv);
if (copy != NULL)