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:
committed by
Iker Pedrosa
parent
24367027d6
commit
624bacfbd8
+1
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user