summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
authormmcc@openbsd.org <mmcc@openbsd.org>2015-12-10 17:08:40 +0000
committerDamien Miller <djm@mindrot.org>2015-12-11 13:23:14 +1100
commitd59ce08811bf94111c2f442184cf7d1257ffae24 (patch)
tree5885ad687f762834250c9c3f5b53b3f1b750c9f1 /sshkey.c
parent8e56dd46cb37879c73bce2d6032cf5e7f82d5a71 (diff)
upstream commit
Remove NULL-checks before free(). ok dtucker@ Upstream-ID: e3d3cb1ce900179906af36517b5eea0fb15e6ef8
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sshkey.c b/sshkey.c
index 587bf5b8..87abea1e 100644
--- a/sshkey.c
+++ b/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.
@@ -426,12 +426,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));
@@ -2473,10 +2471,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;
@@ -3764,8 +3760,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)