Replace mh_xmalloc() with mh_xcalloc()
[mmh] / uip / scansbr.c
index d985a5c..ed163f3 100644 (file)
@@ -88,8 +88,8 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg,
                                        width = MAXSCANL;
                        }
                        dat[3] = slwidth = width;
-                       scanl = (char *) mh_xmalloc((size_t) SCAN_CHARWIDTH *
-                                       (slwidth + 2));  /* probably for \n and \0 */
+                       scanl = (char *) mh_xcalloc((size_t)(slwidth + 2),
+                                       SCAN_CHARWIDTH);  /* probably for \n and \0 */
                        /* Compile format string */
                        ncomps = fmt_compile(fmtstr, &fmt) + 1;
                        FINDCOMP(datecomp, "date");
@@ -107,7 +107,7 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg,
                *used_buf = NULL;
                /* allocate space for the items */
                for (i = ncomps; i--; )
-                       *nxtbuf++ = mh_xmalloc(SBUFSIZ);
+                       *nxtbuf++ = mh_xcalloc(SBUFSIZ, sizeof(char));
        }
 
        /*