diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-12-11 02:31:48 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-12-11 02:31:48 +0000 |
commit | 38a8fa4e6737c550fe5f71ae7d4368852e24ce3a (patch) | |
tree | 12bea6e177d612b59ecae473521b3d1a8b711241 /usr.bin | |
parent | d14801b82ed7e5d1399ed61d6637f066142e712c (diff) |
Remove NULL-checks before sshkey_free().
ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/authfile.c | 14 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-add.c | 8 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 5 | ||||
-rw-r--r-- | usr.bin/ssh/sshconnect2.c | 5 | ||||
-rw-r--r-- | usr.bin/ssh/sshkey.c | 14 |
5 files changed, 17 insertions, 29 deletions
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c index 3a6f8d454e8..41b3f14b175 100644 --- a/usr.bin/ssh/authfile.c +++ b/usr.bin/ssh/authfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: authfile.c,v 1.118 2015/12/10 17:08:40 mmcc Exp $ */ +/* $OpenBSD: authfile.c,v 1.119 2015/12/11 02:31:47 mmcc Exp $ */ /* * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. * @@ -422,8 +422,7 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp) out: free(file); - if (pub != NULL) - sshkey_free(pub); + sshkey_free(pub); return r; } @@ -468,10 +467,8 @@ sshkey_load_private_cert(int type, const char *filename, const char *passphrase, *keyp = key; key = NULL; out: - if (key != NULL) - sshkey_free(key); - if (cert != NULL) - sshkey_free(cert); + sshkey_free(key); + sshkey_free(cert); return r; } @@ -532,8 +529,7 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type, } r = SSH_ERR_KEY_NOT_FOUND; out: - if (pub != NULL) - sshkey_free(pub); + sshkey_free(pub); fclose(f); return r; } diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c index 3eebd5e47b3..d45f64f4f93 100644 --- a/usr.bin/ssh/ssh-add.c +++ b/usr.bin/ssh/ssh-add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-add.c,v 1.126 2015/10/15 23:51:40 djm Exp $ */ +/* $OpenBSD: ssh-add.c,v 1.127 2015/12/11 02:31:47 mmcc Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -142,10 +142,8 @@ delete_file(int agent_fd, const char *filename, int key_only) certpath, ssh_err(r)); out: - if (cert != NULL) - sshkey_free(cert); - if (public != NULL) - sshkey_free(public); + sshkey_free(cert); + sshkey_free(public); free(certpath); free(comment); diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index 14d8ebefde1..6e106a3b55c 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.285 2015/12/04 16:41:28 markus Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.286 2015/12/11 02:31:47 mmcc Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -2152,8 +2152,7 @@ do_gen_krl(struct passwd *pw, int updating, int argc, char **argv) close(fd); sshbuf_free(kbuf); ssh_krl_free(krl); - if (ca != NULL) - sshkey_free(ca); + sshkey_free(ca); } static void diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c index 07dc1c4d9da..1dd67cf34f7 100644 --- a/usr.bin/ssh/sshconnect2.c +++ b/usr.bin/ssh/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.234 2015/12/11 02:20:28 djm Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.235 2015/12/11 02:31:47 mmcc Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2008 Damien Miller. All rights reserved. @@ -1410,8 +1410,7 @@ pubkey_cleanup(Authctxt *authctxt) for (id = TAILQ_FIRST(&authctxt->keys); id; id = TAILQ_FIRST(&authctxt->keys)) { TAILQ_REMOVE(&authctxt->keys, id, next); - if (id->key) - sshkey_free(id->key); + sshkey_free(id->key); free(id->filename); free(id); } diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c index edf0fa43162..e5500268893 100644 --- a/usr.bin/ssh/sshkey.c +++ b/usr.bin/ssh/sshkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.c,v 1.29 2015/12/10 17:08:40 mmcc Exp $ */ +/* $OpenBSD: sshkey.c,v 1.30 2015/12/11 02:31:47 mmcc Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved. @@ -410,8 +410,7 @@ cert_free(struct sshkey_cert *cert) for (i = 0; i < cert->nprincipals; i++) free(cert->principals[i]); free(cert->principals); - if (cert->signature_key != NULL) - sshkey_free(cert->signature_key); + sshkey_free(cert->signature_key); explicit_bzero(cert, sizeof(*cert)); free(cert); } @@ -3591,8 +3590,7 @@ sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob, out: if (copy != NULL) sshbuf_free(copy); - if (pub != NULL) - sshkey_free(pub); + sshkey_free(pub); return r; } @@ -3705,8 +3703,7 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase, out: explicit_bzero(&ciphercontext, sizeof(ciphercontext)); free(comment); - if (prv != NULL) - sshkey_free(prv); + sshkey_free(prv); if (copy != NULL) sshbuf_free(copy); if (decrypted != NULL) @@ -3798,8 +3795,7 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, BIO_free(bio); if (pk != NULL) EVP_PKEY_free(pk); - if (prv != NULL) - sshkey_free(prv); + sshkey_free(prv); return r; } #endif /* WITH_OPENSSL */ |