}
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");
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;