summaryrefslogtreecommitdiffstats
path: root/lib/pwmem.c
diff options
context:
space:
mode:
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);