summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authfile.c14
-rw-r--r--ssh-add.c8
-rw-r--r--ssh-keygen.c5
-rw-r--r--sshconnect2.c5
-rw-r--r--sshkey.c14
5 files changed, 17 insertions, 29 deletions
diff --git a/authfile.c b/authfile.c
index 668df7d9e..9cd490ca3 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.118 2015/12/10 17:08:40 mmcc Exp $ */ 1/* $OpenBSD: authfile.c,v 1.119 2015/12/11 02:31:47 mmcc Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
4 * 4 *
@@ -427,8 +427,7 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp)
427 427
428 out: 428 out:
429 free(file); 429 free(file);
430 if (pub != NULL) 430 sshkey_free(pub);
431 sshkey_free(pub);
432 return r; 431 return r;
433} 432}
434 433
@@ -473,10 +472,8 @@ sshkey_load_private_cert(int type, const char *filename, const char *passphrase,
473 *keyp = key; 472 *keyp = key;
474 key = NULL; 473 key = NULL;
475 out: 474 out:
476 if (key != NULL) 475 sshkey_free(key);
477 sshkey_free(key); 476 sshkey_free(cert);
478 if (cert != NULL)
479 sshkey_free(cert);
480 return r; 477 return r;
481} 478}
482 479
@@ -537,8 +534,7 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type,
537 } 534 }
538 r = SSH_ERR_KEY_NOT_FOUND; 535 r = SSH_ERR_KEY_NOT_FOUND;
539 out: 536 out:
540 if (pub != NULL) 537 sshkey_free(pub);
541 sshkey_free(pub);
542 fclose(f); 538 fclose(f);
543 return r; 539 return r;
544} 540}
diff --git a/ssh-add.c b/ssh-add.c
index cd13d87e5..b95841afa 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-add.c,v 1.126 2015/10/15 23:51:40 djm Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.127 2015/12/11 02:31:47 mmcc Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -150,10 +150,8 @@ delete_file(int agent_fd, const char *filename, int key_only)
150 certpath, ssh_err(r)); 150 certpath, ssh_err(r));
151 151
152 out: 152 out:
153 if (cert != NULL) 153 sshkey_free(cert);
154 sshkey_free(cert); 154 sshkey_free(public);
155 if (public != NULL)
156 sshkey_free(public);
157 free(certpath); 155 free(certpath);
158 free(comment); 156 free(comment);
159 157
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 6ac1fa603..ff3f710de 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.285 2015/12/04 16:41:28 markus Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.286 2015/12/11 02:31:47 mmcc Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2166,8 +2166,7 @@ do_gen_krl(struct passwd *pw, int updating, int argc, char **argv)
2166 close(fd); 2166 close(fd);
2167 sshbuf_free(kbuf); 2167 sshbuf_free(kbuf);
2168 ssh_krl_free(krl); 2168 ssh_krl_free(krl);
2169 if (ca != NULL) 2169 sshkey_free(ca);
2170 sshkey_free(ca);
2171} 2170}
2172 2171
2173static void 2172static void
diff --git a/sshconnect2.c b/sshconnect2.c
index 250278ffe..6c79a7920 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect2.c,v 1.234 2015/12/11 02:20:28 djm Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.235 2015/12/11 02:31:47 mmcc Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Damien Miller. All rights reserved. 4 * Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -1418,8 +1418,7 @@ pubkey_cleanup(Authctxt *authctxt)
1418 for (id = TAILQ_FIRST(&authctxt->keys); id; 1418 for (id = TAILQ_FIRST(&authctxt->keys); id;
1419 id = TAILQ_FIRST(&authctxt->keys)) { 1419 id = TAILQ_FIRST(&authctxt->keys)) {
1420 TAILQ_REMOVE(&authctxt->keys, id, next); 1420 TAILQ_REMOVE(&authctxt->keys, id, next);
1421 if (id->key) 1421 sshkey_free(id->key);
1422 sshkey_free(id->key);
1423 free(id->filename); 1422 free(id->filename);
1424 free(id); 1423 free(id);
1425 } 1424 }
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 */