diff options
author | mmcc@openbsd.org <mmcc@openbsd.org> | 2015-12-10 17:08:40 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-12-11 13:23:14 +1100 |
commit | d59ce08811bf94111c2f442184cf7d1257ffae24 (patch) | |
tree | 5885ad687f762834250c9c3f5b53b3f1b750c9f1 /auth-options.c | |
parent | 8e56dd46cb37879c73bce2d6032cf5e7f82d5a71 (diff) |
upstream commit
Remove NULL-checks before free().
ok dtucker@
Upstream-ID: e3d3cb1ce900179906af36517b5eea0fb15e6ef8
Diffstat (limited to 'auth-options.c')
-rw-r--r-- | auth-options.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/auth-options.c b/auth-options.c index cb68802de..edbaf80bb 100644 --- a/auth-options.c +++ b/auth-options.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth-options.c,v 1.69 2015/11/16 00:30:02 djm Exp $ */ | 1 | /* $OpenBSD: auth-options.c,v 1.70 2015/12/10 17:08:40 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 |
@@ -75,14 +75,10 @@ auth_clear_options(void) | |||
75 | free(ce->s); | 75 | free(ce->s); |
76 | free(ce); | 76 | free(ce); |
77 | } | 77 | } |
78 | if (forced_command) { | 78 | free(forced_command); |
79 | free(forced_command); | 79 | forced_command = NULL; |
80 | forced_command = NULL; | 80 | free(authorized_principals); |
81 | } | 81 | authorized_principals = NULL; |
82 | if (authorized_principals) { | ||
83 | free(authorized_principals); | ||
84 | authorized_principals = NULL; | ||
85 | } | ||
86 | forced_tun_device = -1; | 82 | forced_tun_device = -1; |
87 | channel_clear_permitted_opens(); | 83 | channel_clear_permitted_opens(); |
88 | } | 84 | } |
@@ -175,8 +171,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
175 | cp = "command=\""; | 171 | cp = "command=\""; |
176 | if (strncasecmp(opts, cp, strlen(cp)) == 0) { | 172 | if (strncasecmp(opts, cp, strlen(cp)) == 0) { |
177 | opts += strlen(cp); | 173 | opts += strlen(cp); |
178 | if (forced_command != NULL) | 174 | free(forced_command); |
179 | free(forced_command); | ||
180 | forced_command = xmalloc(strlen(opts) + 1); | 175 | forced_command = xmalloc(strlen(opts) + 1); |
181 | i = 0; | 176 | i = 0; |
182 | while (*opts) { | 177 | while (*opts) { |
@@ -206,8 +201,7 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
206 | cp = "principals=\""; | 201 | cp = "principals=\""; |
207 | if (strncasecmp(opts, cp, strlen(cp)) == 0) { | 202 | if (strncasecmp(opts, cp, strlen(cp)) == 0) { |
208 | opts += strlen(cp); | 203 | opts += strlen(cp); |
209 | if (authorized_principals != NULL) | 204 | free(authorized_principals); |
210 | free(authorized_principals); | ||
211 | authorized_principals = xmalloc(strlen(opts) + 1); | 205 | authorized_principals = xmalloc(strlen(opts) + 1); |
212 | i = 0; | 206 | i = 0; |
213 | while (*opts) { | 207 | while (*opts) { |
@@ -593,8 +587,7 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw, | |||
593 | free(*cert_forced_command); | 587 | free(*cert_forced_command); |
594 | *cert_forced_command = NULL; | 588 | *cert_forced_command = NULL; |
595 | } | 589 | } |
596 | if (name != NULL) | 590 | free(name); |
597 | free(name); | ||
598 | sshbuf_free(data); | 591 | sshbuf_free(data); |
599 | sshbuf_free(c); | 592 | sshbuf_free(c); |
600 | return ret; | 593 | return ret; |
@@ -638,8 +631,7 @@ auth_cert_options(struct sshkey *k, struct passwd *pw) | |||
638 | no_user_rc |= cert_no_user_rc; | 631 | no_user_rc |= cert_no_user_rc; |
639 | /* CA-specified forced command supersedes key option */ | 632 | /* CA-specified forced command supersedes key option */ |
640 | if (cert_forced_command != NULL) { | 633 | if (cert_forced_command != NULL) { |
641 | if (forced_command != NULL) | 634 | free(forced_command); |
642 | free(forced_command); | ||
643 | forced_command = cert_forced_command; | 635 | forced_command = cert_forced_command; |
644 | } | 636 | } |
645 | return 0; | 637 | return 0; |