summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2018-02-07 22:52:46 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2018-02-07 22:52:46 +0000
commit72db52508ce4c14580f2658af0dd32167355efc4 (patch)
tree6a15ae5afb237e1574ef6e99709ff8f6c4ebbfc0 /usr.bin
parent0730eb7236cf99fbe49038c58fd48ea81be99906 (diff)
ssh_free checks for and handles NULL args, remove NULL checks from remaining
callers. ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/auth2-pubkey.c8
-rw-r--r--usr.bin/ssh/ssh-keysign.c4
-rw-r--r--usr.bin/ssh/sshconnect.c5
-rw-r--r--usr.bin/ssh/sshconnect2.c5
4 files changed, 9 insertions, 13 deletions
diff --git a/usr.bin/ssh/auth2-pubkey.c b/usr.bin/ssh/auth2-pubkey.c
index 4b974a11647..5fd4b3e1cf2 100644
--- a/usr.bin/ssh/auth2-pubkey.c
+++ b/usr.bin/ssh/auth2-pubkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-pubkey.c,v 1.75 2018/01/23 05:27:21 djm Exp $ */
+/* $OpenBSD: auth2-pubkey.c,v 1.76 2018/02/07 22:52:45 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -468,8 +468,7 @@ check_authkeys_file(FILE *f, char *file, struct sshkey *key, struct passwd *pw)
/* Always consume entire file */
if (found_key)
continue;
- if (found != NULL)
- sshkey_free(found);
+ sshkey_free(found);
found = sshkey_new(sshkey_is_cert(key) ? KEY_UNSPEC : key->type);
if (found == NULL)
goto done;
@@ -560,8 +559,7 @@ check_authkeys_file(FILE *f, char *file, struct sshkey *key, struct passwd *pw)
}
}
done:
- if (found != NULL)
- sshkey_free(found);
+ sshkey_free(found);
if (!found_key)
debug2("key not found");
return found_key;
diff --git a/usr.bin/ssh/ssh-keysign.c b/usr.bin/ssh/ssh-keysign.c
index c40bad96b3f..dc2c5eec457 100644
--- a/usr.bin/ssh/ssh-keysign.c
+++ b/usr.bin/ssh/ssh-keysign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keysign.c,v 1.52 2016/02/15 09:47:49 dtucker Exp $ */
+/* $OpenBSD: ssh-keysign.c,v 1.53 2018/02/07 22:52:45 dtucker Exp $ */
/*
* Copyright (c) 2002 Markus Friedl. All rights reserved.
*
@@ -148,7 +148,7 @@ valid_request(struct passwd *pw, char *host, struct sshkey **ret,
debug3("%s: fail %d", __func__, fail);
- if (fail && key != NULL)
+ if (fail)
sshkey_free(key);
else if (ret != NULL)
*ret = key;
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c
index f759df1a25e..fc7a4f9b9dd 100644
--- a/usr.bin/ssh/sshconnect.c
+++ b/usr.bin/ssh/sshconnect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.292 2018/01/23 18:33:49 stsp Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.293 2018/02/07 22:52:45 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1149,8 +1149,7 @@ fail:
host_key = raw_key;
goto retry;
}
- if (raw_key != NULL)
- sshkey_free(raw_key);
+ sshkey_free(raw_key);
free(ip);
free(host);
if (host_hostkeys != NULL)
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c
index e23fd302d75..5d330494e4b 100644
--- a/usr.bin/ssh/sshconnect2.c
+++ b/usr.bin/ssh/sshconnect2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.267 2018/01/23 05:27:21 djm Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.268 2018/02/07 22:52:45 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -616,8 +616,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
}
}
done:
- if (key != NULL)
- key_free(key);
+ key_free(key);
free(pkalg);
free(pkblob);