Replace free() with mh_free0()
[mmh] / uip / mhstore.c
index fae054f..4f84570 100644 (file)
@@ -261,7 +261,7 @@ main(int argc, char **argv)
        ** check if message is coming from file
        */
        if (file) {
-               cts = (CT *) mh_xcalloc((size_t) 2, sizeof(*cts));
+               cts = mh_xcalloc(2, sizeof(*cts));
                ctp = cts;
 
                if ((ct = parse_mime(file)))
@@ -293,8 +293,7 @@ main(int argc, char **argv)
                                exit(EX_USAGE);
                seq_setprev(mp);  /* set the previous-sequence */
 
-               cts = (CT *) mh_xcalloc((size_t) (mp->numsel + 1),
-                               sizeof(*cts));
+               cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
                ctp = cts;
 
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
@@ -339,8 +338,7 @@ main(int argc, char **argv)
        for (ctp = cts; *ctp; ctp++)
                free_content(*ctp);
 
-       free((char *) cts);
-       cts = NULL;
+       mh_free0(&cts);
 
        /* If reading from a folder, do some updating */
        if (mp) {
@@ -568,7 +566,7 @@ store_partial(CT ct)
                return NOTOK;
        }
 
-       base = (CT *) mh_xcalloc((size_t) (i + 1), sizeof(*base));
+       base = mh_xcalloc(i + 1, sizeof(*base));
 
        ctq = base;
        for (ctp = cts; *ctp; ctp++) {
@@ -614,7 +612,7 @@ missing_part:
        ct = *ctq++;
        if (store_content(ct, NULL) == NOTOK) {
 losing:
-               free((char *) base);
+               mh_free0(&base);
                return NOTOK;
        }
 
@@ -624,7 +622,7 @@ losing:
                        goto losing;
        }
 
-       free((char *) base);
+       mh_free0(&base);
        return OK;
 }
 
@@ -789,7 +787,7 @@ store_content(CT ct, CT p)
                ct->c_folder = getcpy(folder);
 
                if (cp[1])
-                       free(folder);
+                       mh_free0(&folder);
 
                goto got_filename;
        }