summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/auth-options.c26
-rw-r--r--usr.bin/ssh/authfile.c5
-rw-r--r--usr.bin/ssh/cipher.c5
-rw-r--r--usr.bin/ssh/kex.c5
-rw-r--r--usr.bin/ssh/packet.c14
-rw-r--r--usr.bin/ssh/ssh-dss.c5
-rw-r--r--usr.bin/ssh/ssh-rsa.c5
-rw-r--r--usr.bin/ssh/ssh.c5
-rw-r--r--usr.bin/ssh/sshconnect2.c5
-rw-r--r--usr.bin/ssh/sshd.c5
-rw-r--r--usr.bin/ssh/sshkey.c17
11 files changed, 36 insertions, 61 deletions
diff --git a/usr.bin/ssh/auth-options.c b/usr.bin/ssh/auth-options.c
index 42ca9f49cc4..a2213b24a11 100644
--- a/usr.bin/ssh/auth-options.c
+++ b/usr.bin/ssh/auth-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth-options.c,v 1.69 2015/11/16 00:30:02 djm Exp $ */
+/* $OpenBSD: auth-options.c,v 1.70 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -72,14 +72,10 @@ auth_clear_options(void)
free(ce->s);
free(ce);
}
- if (forced_command) {
- free(forced_command);
- forced_command = NULL;
- }
- if (authorized_principals) {
- free(authorized_principals);
- authorized_principals = NULL;
- }
+ free(forced_command);
+ forced_command = NULL;
+ free(authorized_principals);
+ authorized_principals = NULL;
forced_tun_device = -1;
channel_clear_permitted_opens();
}
@@ -172,8 +168,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
cp = "command=\"";
if (strncasecmp(opts, cp, strlen(cp)) == 0) {
opts += strlen(cp);
- if (forced_command != NULL)
- free(forced_command);
+ free(forced_command);
forced_command = xmalloc(strlen(opts) + 1);
i = 0;
while (*opts) {
@@ -203,8 +198,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
cp = "principals=\"";
if (strncasecmp(opts, cp, strlen(cp)) == 0) {
opts += strlen(cp);
- if (authorized_principals != NULL)
- free(authorized_principals);
+ free(authorized_principals);
authorized_principals = xmalloc(strlen(opts) + 1);
i = 0;
while (*opts) {
@@ -590,8 +584,7 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw,
free(*cert_forced_command);
*cert_forced_command = NULL;
}
- if (name != NULL)
- free(name);
+ free(name);
sshbuf_free(data);
sshbuf_free(c);
return ret;
@@ -635,8 +628,7 @@ auth_cert_options(struct sshkey *k, struct passwd *pw)
no_user_rc |= cert_no_user_rc;
/* CA-specified forced command supersedes key option */
if (cert_forced_command != NULL) {
- if (forced_command != NULL)
- free(forced_command);
+ free(forced_command);
forced_command = cert_forced_command;
}
return 0;
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c
index 1740150a8b5..3a6f8d454e8 100644
--- a/usr.bin/ssh/authfile.c
+++ b/usr.bin/ssh/authfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfile.c,v 1.117 2015/09/13 14:39:16 tim Exp $ */
+/* $OpenBSD: authfile.c,v 1.118 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
*
@@ -421,8 +421,7 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp)
r = 0;
out:
- if (file != NULL)
- free(file);
+ free(file);
if (pub != NULL)
sshkey_free(pub);
return r;
diff --git a/usr.bin/ssh/cipher.c b/usr.bin/ssh/cipher.c
index 4e74ca73120..c4341e270db 100644
--- a/usr.bin/ssh/cipher.c
+++ b/usr.bin/ssh/cipher.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cipher.c,v 1.100 2015/01/14 10:29:45 djm Exp $ */
+/* $OpenBSD: cipher.c,v 1.101 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -347,8 +347,7 @@ cipher_init(struct sshcipher_ctx *cc, const struct sshcipher *cipher,
if (cipher->discard_len > 0) {
if ((junk = malloc(cipher->discard_len)) == NULL ||
(discard = malloc(cipher->discard_len)) == NULL) {
- if (junk != NULL)
- free(junk);
+ free(junk);
ret = SSH_ERR_ALLOC_FAIL;
goto bad;
}
diff --git a/usr.bin/ssh/kex.c b/usr.bin/ssh/kex.c
index 76a675b627a..db74e2755fe 100644
--- a/usr.bin/ssh/kex.c
+++ b/usr.bin/ssh/kex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.113 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: kex.c,v 1.114 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -885,8 +885,7 @@ derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
digest = NULL;
r = 0;
out:
- if (digest)
- free(digest);
+ free(digest);
ssh_digest_free(hashctx);
return r;
}
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c
index d0d5055d5d4..c75313e7f05 100644
--- a/usr.bin/ssh/packet.c
+++ b/usr.bin/ssh/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.218 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: packet.c,v 1.219 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -508,10 +508,8 @@ ssh_packet_close(struct ssh *ssh)
error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
if ((r = cipher_cleanup(&state->receive_context)) != 0)
error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
- if (ssh->remote_ipaddr) {
- free(ssh->remote_ipaddr);
- ssh->remote_ipaddr = NULL;
- }
+ free(ssh->remote_ipaddr);
+ ssh->remote_ipaddr = NULL;
free(ssh->state);
ssh->state = NULL;
}
@@ -1772,8 +1770,7 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
if ((r = sshpkt_get_u8(ssh, NULL)) != 0 ||
(r = sshpkt_get_string(ssh, &msg, NULL)) != 0 ||
(r = sshpkt_get_string(ssh, NULL, NULL)) != 0) {
- if (msg)
- free(msg);
+ free(msg);
return r;
}
debug("Remote: %.900s", msg);
@@ -2550,8 +2547,7 @@ newkeys_from_blob(struct sshbuf *m, struct ssh *ssh, int mode)
newkey = NULL;
r = 0;
out:
- if (newkey != NULL)
- free(newkey);
+ free(newkey);
if (b != NULL)
sshbuf_free(b);
return r;
diff --git a/usr.bin/ssh/ssh-dss.c b/usr.bin/ssh/ssh-dss.c
index c7548e0d619..d3ce6641a6f 100644
--- a/usr.bin/ssh/ssh-dss.c
+++ b/usr.bin/ssh/ssh-dss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-dss.c,v 1.32 2014/06/24 01:13:21 djm Exp $ */
+/* $OpenBSD: ssh-dss.c,v 1.33 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -205,8 +205,7 @@ ssh_dss_verify(const struct sshkey *key,
DSA_SIG_free(sig);
if (b != NULL)
sshbuf_free(b);
- if (ktype != NULL)
- free(ktype);
+ free(ktype);
if (sigblob != NULL) {
explicit_bzero(sigblob, len);
free(sigblob);
diff --git a/usr.bin/ssh/ssh-rsa.c b/usr.bin/ssh/ssh-rsa.c
index e7ed90626fe..e8ca0eda063 100644
--- a/usr.bin/ssh/ssh-rsa.c
+++ b/usr.bin/ssh/ssh-rsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-rsa.c,v 1.56 2015/12/07 20:04:09 markus Exp $ */
+/* $OpenBSD: ssh-rsa.c,v 1.57 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000, 2003 Markus Friedl <markus@openbsd.org>
*
@@ -221,8 +221,7 @@ ssh_rsa_verify(const struct sshkey *key,
explicit_bzero(sigblob, len);
free(sigblob);
}
- if (ktype != NULL)
- free(ktype);
+ free(ktype);
if (b != NULL)
sshbuf_free(b);
explicit_bzero(digest, sizeof(digest));
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index ce7222a696b..eceb325b468 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.430 2015/11/19 08:23:27 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.431 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -881,8 +881,7 @@ main(int ac, char **av)
subsystem_flag = 1;
break;
case 'S':
- if (options.control_path != NULL)
- free(options.control_path);
+ free(options.control_path);
options.control_path = xstrdup(optarg);
break;
case 'b':
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c
index d5bf301947b..8639426dfca 100644
--- a/usr.bin/ssh/sshconnect2.c
+++ b/usr.bin/ssh/sshconnect2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.231 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.232 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -1249,8 +1249,7 @@ load_identity_file(Identity *id)
explicit_bzero(passphrase, strlen(passphrase));
free(passphrase);
}
- if (comment)
- free(comment);
+ free(comment);
if (private != NULL || quit)
break;
}
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 44fc90ce698..599ee39ef2f 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.461 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: sshd.c,v 1.462 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1204,8 +1204,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
for (;;) {
if (received_sighup)
sighup_restart();
- if (fdset != NULL)
- free(fdset);
+ free(fdset);
fdset = xcalloc(howmany(maxfd + 1, NFDBITS),
sizeof(fd_mask));
diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c
index 626acf2f1f8..edf0fa43162 100644
--- a/usr.bin/ssh/sshkey.c
+++ b/usr.bin/ssh/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.28 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: sshkey.c,v 1.29 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -406,12 +406,10 @@ cert_free(struct sshkey_cert *cert)
sshbuf_free(cert->critical);
if (cert->extensions != NULL)
sshbuf_free(cert->extensions);
- if (cert->key_id != NULL)
- free(cert->key_id);
+ free(cert->key_id);
for (i = 0; i < cert->nprincipals; i++)
free(cert->principals[i]);
- if (cert->principals != NULL)
- free(cert->principals);
+ free(cert->principals);
if (cert->signature_key != NULL)
sshkey_free(cert->signature_key);
explicit_bzero(cert, sizeof(*cert));
@@ -2427,10 +2425,8 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
out:
if (ret != 0)
sshbuf_reset(cert);
- if (sig_blob != NULL)
- free(sig_blob);
- if (ca_blob != NULL)
- free(ca_blob);
+ free(sig_blob);
+ free(ca_blob);
if (principals != NULL)
sshbuf_free(principals);
return ret;
@@ -3708,8 +3704,7 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
}
out:
explicit_bzero(&ciphercontext, sizeof(ciphercontext));
- if (comment != NULL)
- free(comment);
+ free(comment);
if (prv != NULL)
sshkey_free(prv);
if (copy != NULL)