MALLOC() + memset() is simpler written as CALLOC().
Cc: Christian Göttsche <cgzones@googlemail.com>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
*/
/* Create an array to hold all of the discovered UIDs */
- used_uids = MALLOC(uid_max + 1, bool);
+ used_uids = CALLOC(uid_max + 1, bool);
if (NULL == used_uids) {
fprintf (log_get_logfd(),
_("%s: failed to allocate memory: %s\n"),
log_get_progname(), strerror (errno));
return -1;
}
- memset (used_uids, false, sizeof (bool) * (uid_max + 1));
/* First look for the lowest and highest value in the local database */
(void) pw_rewind ();
struct group *gr;
int i;
- gr = MALLOC(1, struct group);
+ gr = CALLOC(1, struct group);
if (NULL == gr) {
return NULL;
}
/* The libc might define other fields. They won't be copied. */
- memset (gr, 0, sizeof *gr);
gr->gr_gid = grent->gr_gid;
/*@-mustfreeonly@*/
gr->gr_name = strdup (grent->gr_name);