Replace mh_xmalloc() with mh_xcalloc()
[mmh] / uip / flist.c
index 68acabb..d2433a2 100644 (file)
@@ -143,8 +143,7 @@ main(int argc, char **argv)
        /* allocate the initial space to record the folder names */
        numfolders = 0;
        maxfolders = MAXFOLDERS;
-       foldersToDo = (char **) mh_xmalloc((size_t)
-                       (maxfolders * sizeof(*foldersToDo)));
+       foldersToDo = (char **) mh_xcalloc((size_t) maxfolders, sizeof(*foldersToDo));
 
        /* no sequences yet */
        numsequences = 0;
@@ -295,7 +294,7 @@ GetFolderOrder(void)
                        AllocFolders(&orders, &nOrdersAlloced, nOrders + 1);
                        o = &orders[nOrders++];
                        o->priority = priority++;
-                       o->name = (char *) mh_xmalloc(p - s + 1);
+                       o->name = (char *) mh_xcalloc(p - s + 1, sizeof(char));
                        strncpy(o->name, s, p - s);
                        o->name[p - s] = 0;
                } else
@@ -624,8 +623,7 @@ AllocFolders(struct Folder **f, int *nfa, int n)
                return;
        if (*f == NULL) {
                *nfa = 10;
-               *f = (struct Folder *) mh_xmalloc(
-                               *nfa * (sizeof(struct Folder)));
+               *f = (struct Folder *) mh_xcalloc(*nfa, sizeof(struct Folder));
        } else {
                *nfa *= 2;
                *f = (struct Folder *) mh_xrealloc(