Avoid side effects in macro arguments (don't I ever learn?); also
address some related style issues. Submitted by: Dmitry V. Levin <ldv@altlinux.org> git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@262 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
108a953440
commit
922d9cb144
|
@ -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