* patch #3967: Create a mh_xrealloc function to prevent mistakes when
[mmh] / uip / dropsbr.c
index 45d5c28..dae1c3b 100644 (file)
@@ -3,9 +3,14 @@
  * dropsbr.c -- create/read/manipulate mail drops
  *
  * $Id$
+ *
+ * This code is Copyright (c) 2002, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
  */
 
 #include <h/nmh.h>
+#include <h/utils.h>
 
 #ifndef        MMDFONLY
 # include <h/mh.h>
@@ -31,8 +36,6 @@
 
 #include <fcntl.h>
 
-extern int errno;
-
 /*
  * static prototypes
  */
@@ -222,14 +225,8 @@ mbx_read (FILE *fp, long pos, struct drop **drops, int noisy)
        if (dp >= ep) {
            register int    curlen = dp - pp;
 
-           cp = (struct drop *) realloc ((char *) pp,
+           cp = (struct drop *) mh_xrealloc ((char *) pp,
                                    (size_t) (len += MAXFOLDER) * sizeof(*pp));
-           if (cp == NULL) {
-               if (noisy)
-                   admonish (NULL, "unable to allocate drop storage");
-               free ((char *) pp);
-               return 0;
-           }
            dp = cp + curlen, ep = (pp = cp) + len - 1;
        }
     }