exit mem_realloc, enters p_realloc/xrealloc.
[apps/madmutt.git] / imap / imap.c
index 8c7cc5e..17e94a2 100644 (file)
@@ -31,7 +31,6 @@
 #endif
 #include "buffy.h"
 
-#include "lib/mem.h"
 #include "lib/intl.h"
 #include "lib/str.h"
 #include "lib/debug.h"
@@ -692,8 +691,8 @@ int imap_open_mailbox (CONTEXT * ctx)
   }
 
   ctx->hdrmax = count;
-  ctx->hdrs = mem_calloc (count, sizeof (HEADER *));
-  ctx->v2r = mem_calloc (count, sizeof (int));
+  ctx->hdrs = p_new(HEADER *, count);
+  ctx->v2r = p_new(int, count);
   ctx->msgcount = 0;
   if (count && (imap_read_headers (idata, 0, count - 1) < 0)) {
     mutt_error _("Error opening mailbox");
@@ -816,8 +815,7 @@ int imap_make_msg_set (IMAP_DATA * idata, BUFFER * buf, int flag, int changed)
   int started = 0;
 
   /* make copy of header pointers to sort in natural order */
-  hdrs = mem_calloc (idata->ctx->msgcount, sizeof (HEADER *));
-  memcpy (hdrs, idata->ctx->hdrs, idata->ctx->msgcount * sizeof (HEADER *));
+  hdrs = p_dup(idata->ctx->hdrs, idata->ctx->msgcount);
 
   if (Sort != SORT_ORDER) {
     oldsort = Sort;