diff options
author | des <des@FreeBSD.org> | 2003-06-18 09:44:09 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-06-18 09:44:09 +0000 |
commit | 49e0f275db6cafef33693cb9ac1fdd52cdd63a67 (patch) | |
tree | 7a0c87730c03e720760c03e894817455d157a988 /contrib | |
parent | f4ecd4746647669fad236aa0e46da57f7761a0da (diff) | |
download | FreeBSD-src-49e0f275db6cafef33693cb9ac1fdd52cdd63a67.zip FreeBSD-src-49e0f275db6cafef33693cb9ac1fdd52cdd63a67.tar.gz |
Avoid side effects in macro arguments (perforce change #33323)
Submitted by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/openpam/lib/openpam_load.c | 7 | ||||
-rw-r--r-- | contrib/openpam/lib/pam_end.c | 8 | ||||
-rw-r--r-- | contrib/openpam/lib/pam_getenvlist.c | 8 |
3 files changed, 15 insertions, 8 deletions
diff --git a/contrib/openpam/lib/openpam_load.c b/contrib/openpam/lib/openpam_load.c index a1057f3..838f72e 100644 --- a/contrib/openpam/lib/openpam_load.c +++ b/contrib/openpam/lib/openpam_load.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_load.c#19 $ + * $P4: //depot/projects/openpam/lib/openpam_load.c#20 $ */ #include <dlfcn.h> @@ -153,10 +153,13 @@ openpam_destroy_chain(pam_chain_t *chain) return; openpam_destroy_chain(chain->next); chain->next = NULL; - while (chain->optc--) + while (chain->optc) { + --chain->optc; FREE(chain->optv[chain->optc]); + } FREE(chain->optv); openpam_release_module(chain->module); + chain->module = NULL; FREE(chain); } diff --git a/contrib/openpam/lib/pam_end.c b/contrib/openpam/lib/pam_end.c index e1762c6..0dd3ea7 100644 --- a/contrib/openpam/lib/pam_end.c +++ b/contrib/openpam/lib/pam_end.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_end.c#13 $ + * $P4: //depot/projects/openpam/lib/pam_end.c#14 $ */ #include <stdlib.h> @@ -68,8 +68,10 @@ pam_end(pam_handle_t *pamh, } /* clear environment */ - while (pamh->env_count) - FREE(pamh->env[--pamh->env_count]); + while (pamh->env_count) { + --pamh->env_count; + FREE(pamh->env[pamh->env_count]); + } FREE(pamh->env); /* clear chains */ diff --git a/contrib/openpam/lib/pam_getenvlist.c b/contrib/openpam/lib/pam_getenvlist.c index 2ba1bdf..82f2320 100644 --- a/contrib/openpam/lib/pam_getenvlist.c +++ b/contrib/openpam/lib/pam_getenvlist.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_getenvlist.c#12 $ + * $P4: //depot/projects/openpam/lib/pam_getenvlist.c#13 $ */ #include <stdlib.h> @@ -65,8 +65,10 @@ pam_getenvlist(pam_handle_t *pamh) } for (i = 0; i < pamh->env_count; ++i) { if ((envlist[i] = strdup(pamh->env[i])) == NULL) { - while (i) - FREE(envlist[--i]); + while (i) { + --i; + FREE(envlist[i]); + } FREE(envlist); openpam_log(PAM_LOG_ERROR, "%s", pam_strerror(pamh, PAM_BUF_ERR)); |