Use calloc(3) instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2023-02-04 21:43:43 +01:00
committed by Serge Hallyn
parent 1aa22c1467
commit a578617cc0
4 changed files with 4 additions and 8 deletions

View File

@@ -25,13 +25,12 @@
struct sgrp *sg;
int i;
sg = (struct sgrp *) malloc (sizeof *sg);
sg = (struct sgrp *) calloc (1, sizeof *sg);
if (NULL == sg) {
return NULL;
}
/* Do the same as the other _dup function, even if we know the
* structure. */
memset (sg, 0, sizeof *sg);
/*@-mustfreeonly@*/
sg->sg_name = strdup (sgent->sg_name);
/*@=mustfreeonly@*/