summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
authormmcc@openbsd.org <mmcc@openbsd.org>2015-12-11 02:31:47 +0000
committerDamien Miller <djm@mindrot.org>2015-12-18 14:49:32 +1100
commit89540b6de025b80404a0cb8418c06377f3f98848 (patch)
treee5ba6b2acbaab9aa3b89c3ff0c0b14adddfa19db /sshkey.c
parent79394ed6d74572c2d2643d73937dad33727fc240 (diff)
upstream commit
Remove NULL-checks before sshkey_free(). ok djm@ Upstream-ID: 3e35afe8a25e021216696b5d6cde7f5d2e5e3f52
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sshkey.c b/sshkey.c
index 87abea1e0..96a4d9090 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.29 2015/12/10 17:08:40 mmcc Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.30 2015/12/11 02:31:47 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.
@@ -430,8 +430,7 @@ cert_free(struct sshkey_cert *cert)
430 for (i = 0; i < cert->nprincipals; i++) 430 for (i = 0; i < cert->nprincipals; i++)
431 free(cert->principals[i]); 431 free(cert->principals[i]);
432 free(cert->principals); 432 free(cert->principals);
433 if (cert->signature_key != NULL) 433 sshkey_free(cert->signature_key);
434 sshkey_free(cert->signature_key);
435 explicit_bzero(cert, sizeof(*cert)); 434 explicit_bzero(cert, sizeof(*cert));
436 free(cert); 435 free(cert);
437} 436}
@@ -3647,8 +3646,7 @@ sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
3647 out: 3646 out:
3648 if (copy != NULL) 3647 if (copy != NULL)
3649 sshbuf_free(copy); 3648 sshbuf_free(copy);
3650 if (pub != NULL) 3649 sshkey_free(pub);
3651 sshkey_free(pub);
3652 return r; 3650 return r;
3653} 3651}
3654 3652
@@ -3761,8 +3759,7 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
3761 out: 3759 out:
3762 explicit_bzero(&ciphercontext, sizeof(ciphercontext)); 3760 explicit_bzero(&ciphercontext, sizeof(ciphercontext));
3763 free(comment); 3761 free(comment);
3764 if (prv != NULL) 3762 sshkey_free(prv);
3765 sshkey_free(prv);
3766 if (copy != NULL) 3763 if (copy != NULL)
3767 sshbuf_free(copy); 3764 sshbuf_free(copy);
3768 if (decrypted != NULL) 3765 if (decrypted != NULL)
@@ -3856,8 +3853,7 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3856 BIO_free(bio); 3853 BIO_free(bio);
3857 if (pk != NULL) 3854 if (pk != NULL)
3858 EVP_PKEY_free(pk); 3855 EVP_PKEY_free(pk);
3859 if (prv != NULL) 3856 sshkey_free(prv);
3860 sshkey_free(prv);
3861 return r; 3857 return r;
3862} 3858}
3863#endif /* WITH_OPENSSL */ 3859#endif /* WITH_OPENSSL */