mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-11 14:10:34 +00:00
Avoid side effects in macro arguments (perforce change #33323)
Submitted by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
parent
726edecf4a
commit
901243b303
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/openpam/dist/; revision=116520
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user