[openssh-commits] [openssh] 02/08: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Dec 18 14:51:13 AEDT 2015


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 89540b6de025b80404a0cb8418c06377f3f98848
Author: mmcc at openbsd.org <mmcc at openbsd.org>
Date:   Fri Dec 11 02:31:47 2015 +0000

    upstream commit
    
    Remove NULL-checks before sshkey_free().
    
    ok djm@
    
    Upstream-ID: 3e35afe8a25e021216696b5d6cde7f5d2e5e3f52
---
 authfile.c    | 14 +++++---------
 ssh-add.c     |  8 +++-----
 ssh-keygen.c  |  5 ++---
 sshconnect2.c |  5 ++---
 sshkey.c      | 14 +++++---------
 5 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/authfile.c b/authfile.c
index 668df7d..9cd490c 100644
--- a/authfile.c
+++ b/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.
  *
@@ -427,8 +427,7 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp)
 
  out:
 	free(file);
-	if (pub != NULL)
-		sshkey_free(pub);
+	sshkey_free(pub);
 	return r;
 }
 
@@ -473,10 +472,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;
 }
 
@@ -537,8 +534,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/ssh-add.c b/ssh-add.c
index cd13d87..b95841a 100644
--- a/ssh-add.c
+++ b/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 at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -150,10 +150,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/ssh-keygen.c b/ssh-keygen.c
index 6ac1fa6..ff3f710 100644
--- a/ssh-keygen.c
+++ b/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 at cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -2166,8 +2166,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/sshconnect2.c b/sshconnect2.c
index 250278f..6c79a79 100644
--- a/sshconnect2.c
+++ b/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.
@@ -1418,8 +1418,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/sshkey.c b/sshkey.c
index 87abea1..96a4d90 100644
--- a/sshkey.c
+++ b/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.
@@ -430,8 +430,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);
 }
@@ -3647,8 +3646,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;
 }
 
@@ -3761,8 +3759,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)
@@ -3856,8 +3853,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 */

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list