* patch #3966: Create a mh_xmalloc function to prevent mistakes when
[mmh] / uip / refile.c
index c184dc1..4d91291 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 #include <fcntl.h>
 #include <errno.h>
 
@@ -97,8 +98,7 @@ main (int argc, char **argv)
      */
     nummsgs = 0;
     maxmsgs = MAXMSGS;
-    if (!(msgs = (char **) malloc ((size_t) (maxmsgs * sizeof(*msgs)))))
-       adios (NULL, "unable to allocate storage");
+    msgs = (char **) mh_xmalloc ((size_t) (maxmsgs * sizeof(*msgs)));
 
     /*
      * Parse arguments
@@ -400,7 +400,7 @@ m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve, int
     struct st_fold *fp, *ep;
 
     for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
-       if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile)) == -1)
+       if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile, maildir)) == -1)
            return 1;
     }
     return 0;