Use calloc(3) instead of its pattern
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
1aa22c1467
commit
a578617cc0
@@ -21,12 +21,11 @@
|
||||
{
|
||||
struct passwd *pw;
|
||||
|
||||
pw = (struct passwd *) malloc (sizeof *pw);
|
||||
pw = (struct passwd *) calloc (1, sizeof *pw);
|
||||
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@*/
|
||||
|
||||
Reference in New Issue
Block a user