* lib/shadowmem.c: Only copy the required fields of the struct
spwd. (start with the primitive types) * lib/shadowmem.c: Avoid memzero() on a possibly NULL pointer. * lib/groupmem.c: Only copy the required fields of the struct group. (start with the primitive types) * lib/groupmem.c: Avoid memzero() on a possibly NULL pointer. * lib/groupmem.c: Free gr_mem in addition to its elements. * lib/sgroupio.c: The struct sgrp has no primitive types to be copied initially. * lib/sgroupio.c: Avoid memzero() on a possibly NULL pointer. * lib/sgroupio.c: Free sg_mem and sg_add in addition to their elements. * lib/pwmem.c: Only copy the required fields of the struct passwd. (start with the primitive types)
This commit is contained in:
@ -49,8 +49,14 @@
|
||||
if (NULL == sp) {
|
||||
return NULL;
|
||||
}
|
||||
*sp = *spent;
|
||||
sp->sp_namp = strdup (spent->sp_namp);
|
||||
sp->sp_lstchg = spent->sp_lstchg;
|
||||
sp->sp_min = spent->sp_min;
|
||||
sp->sp_max = spent->sp_max;
|
||||
sp->sp_warn = spent->sp_warn;
|
||||
sp->sp_inact = spent->sp_inact;
|
||||
sp->sp_expire = spent->sp_expire;
|
||||
sp->sp_flag = spent->sp_flag;
|
||||
sp->sp_namp = strdup (spent->sp_namp);
|
||||
if (NULL == sp->sp_namp) {
|
||||
free(sp);
|
||||
return NULL;
|
||||
@ -68,8 +74,10 @@
|
||||
void spw_free (/*@out@*/ /*@only@*/struct spwd *spent)
|
||||
{
|
||||
free (spent->sp_namp);
|
||||
memzero (spent->sp_pwdp, strlen (spent->sp_pwdp));
|
||||
free (spent->sp_pwdp);
|
||||
if (NULL != spent->sp_pwdp) {
|
||||
memzero (spent->sp_pwdp, strlen (spent->sp_pwdp));
|
||||
free (spent->sp_pwdp);
|
||||
}
|
||||
free (spent);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user