aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2003-06-18 09:44:09 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2003-06-18 09:44:09 +0000
commit901243b303e2120b008d82017cdc2b3c7b0df5e5 (patch)
tree7a0c87730c03e720760c03e894817455d157a988
parent726edecf4add9ad364a484f8670d15b1be01ec23 (diff)
downloadsrc-901243b303e2120b008d82017cdc2b3c7b0df5e5.tar.gz
src-901243b303e2120b008d82017cdc2b3c7b0df5e5.zip
Avoid side effects in macro arguments (perforce change #33323)
Submitted by: Dmitry V. Levin <ldv@altlinux.org>
Notes
Notes: svn path=/vendor/openpam/dist/; revision=116520
-rw-r--r--contrib/openpam/lib/openpam_load.c7
-rw-r--r--contrib/openpam/lib/pam_end.c8
-rw-r--r--contrib/openpam/lib/pam_getenvlist.c8
3 files changed, 15 insertions, 8 deletions
diff --git a/contrib/openpam/lib/openpam_load.c b/contrib/openpam/lib/openpam_load.c
index a1057f39a233..838f72e623c7 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 e1762c6c20c2..0dd3ea75e6ab 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 2ba1bdf26667..82f23204935e 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));