Use CALLOC() instead of its pattern

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>
This commit is contained in:
Alejandro Colomar
2023-07-31 17:30:59 +02:00
committed by Iker Pedrosa
parent 24367027d6
commit 624bacfbd8
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -23,12 +23,11 @@
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);