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 587bf5b84..87abea1e0 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.28 2015/12/04 16:41:28 markus Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.29 2015/12/10 17:08:40 mmcc Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -426,12 +426,10 @@ cert_free(struct sshkey_cert *cert)
426 sshbuf_free(cert->critical); 426 sshbuf_free(cert->critical);
427 if (cert->extensions != NULL) 427 if (cert->extensions != NULL)
428 sshbuf_free(cert->extensions); 428 sshbuf_free(cert->extensions);
429 if (cert->key_id != NULL) 429 free(cert->key_id);
430 free(cert->key_id);
431 for (i = 0; i < cert->nprincipals; i++) 430 for (i = 0; i < cert->nprincipals; i++)
432 free(cert->principals[i]); 431 free(cert->principals[i]);
433 if (cert->principals != NULL) 432 free(cert->principals);
434 free(cert->principals);
435 if (cert->signature_key != NULL) 433 if (cert->signature_key != NULL)
436 sshkey_free(cert->signature_key); 434 sshkey_free(cert->signature_key);
437 explicit_bzero(cert, sizeof(*cert)); 435 explicit_bzero(cert, sizeof(*cert));
@@ -2473,10 +2471,8 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
2473 out: 2471 out:
2474 if (ret != 0) 2472 if (ret != 0)
2475 sshbuf_reset(cert); 2473 sshbuf_reset(cert);
2476 if (sig_blob != NULL) 2474 free(sig_blob);
2477 free(sig_blob); 2475 free(ca_blob);
2478 if (ca_blob != NULL)
2479 free(ca_blob);
2480 if (principals != NULL) 2476 if (principals != NULL)
2481 sshbuf_free(principals); 2477 sshbuf_free(principals);
2482 return ret; 2478 return ret;
@@ -3764,8 +3760,7 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
3764 } 3760 }
3765 out: 3761 out:
3766 explicit_bzero(&ciphercontext, sizeof(ciphercontext)); 3762 explicit_bzero(&ciphercontext, sizeof(ciphercontext));
3767 if (comment != NULL) 3763 free(comment);
3768 free(comment);
3769 if (prv != NULL) 3764 if (prv != NULL)
3770 sshkey_free(prv); 3765 sshkey_free(prv);
3771 if (copy != NULL) 3766 if (copy != NULL)