diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 16:18:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 16:18:36 +0000 |
commit | 6c3ea4f47ea280811a7fe53a22f7832e4533c9ec (patch) | |
tree | 3d7ed5da23b5dbf6f9e450dfb61642832249c31e /lib/pwmem.c | |
parent | Adding upstream version 1:4.13+dfsg1. (diff) | |
download | shadow-upstream.tar.xz shadow-upstream.zip |
Adding upstream version 1:4.15.2.upstream/1%4.15.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/pwmem.c')
-rw-r--r-- | lib/pwmem.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/pwmem.c b/lib/pwmem.c index 867e3f7..9c6e58d 100644 --- a/lib/pwmem.c +++ b/lib/pwmem.c @@ -13,7 +13,10 @@ #ident "$Id$" #include <stdio.h> + +#include "alloc.h" #include "defines.h" +#include "memzero.h" #include "prototypes.h" #include "pwio.h" @@ -21,12 +24,11 @@ { struct passwd *pw; - pw = (struct passwd *) malloc (sizeof *pw); + pw = CALLOC (1, struct passwd); if (NULL == pw) { return NULL; } /* The libc might define other fields. They won't be copied. */ - memset (pw, 0, sizeof *pw); pw->pw_uid = pwent->pw_uid; pw->pw_gid = pwent->pw_gid; /*@-mustfreeonly@*/ @@ -68,7 +70,8 @@ return pw; } -void pw_free (/*@out@*/ /*@only@*/struct passwd *pwent) +void +pw_free(/*@only@*/struct passwd *pwent) { if (pwent != NULL) { free (pwent->pw_name); |