summaryrefslogtreecommitdiffstats
path: root/lib/pwmem.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:18:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:18:39 +0000
commit5242eef8fc54636a41701fd9d7083ba6e4a4e0b3 (patch)
treee6a0980092957865a937cc0f34446df3d5194e99 /lib/pwmem.c
parentReleasing progress-linux version 1:4.13+dfsg1-5~progress7.99u1. (diff)
downloadshadow-5242eef8fc54636a41701fd9d7083ba6e4a4e0b3.tar.xz
shadow-5242eef8fc54636a41701fd9d7083ba6e4a4e0b3.zip
Merging upstream version 1:4.15.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/pwmem.c')
-rw-r--r--lib/pwmem.c9
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);