Hi,

Another malloc & memset to calloc cleanup. This time in mountd.c

Index: mountd.c
===================================================================
RCS file: /cvs/src/sbin/mountd/mountd.c,v
retrieving revision 1.73
diff -u -p -u -r1.73 mountd.c
--- mountd.c    24 Mar 2014 00:19:48 -0000      1.73
+++ mountd.c    22 Apr 2014 19:47:55 -0000
@@ -1057,10 +1057,9 @@ get_exp(void)
 {
        struct exportlist *ep;

-       ep = (struct exportlist *)malloc(sizeof (struct exportlist));
+       ep = calloc(1, sizeof (struct exportlist));
        if (ep == NULL)
                out_of_mem();
-       memset(ep, 0, sizeof(struct exportlist));
        return (ep);
 }

@@ -1072,10 +1071,9 @@ get_grp(void)
 {
        struct grouplist *gp;

-       gp = (struct grouplist *)malloc(sizeof (struct grouplist));
+       gp = calloc(1, sizeof (struct grouplist));
        if (gp == NULL)
                out_of_mem();
-       memset(gp, 0, sizeof(struct grouplist));
        return (gp);
 }

Reply via email to