]> granicus.if.org Git - neomutt/commitdiff
rename memory functions
authorRichard Russon <rich@flatcap.org>
Thu, 16 Nov 2017 01:36:55 +0000 (01:36 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 16 Nov 2017 03:39:56 +0000 (03:39 +0000)
98 files changed:
addrbook.c
alias.c
attach.c
bcache.c
body.c
browser.c
buffy.c
charset.c
color.c
commands.c
compose.c
compress.c
conn/getdomain.c
conn/sasl.c
conn/socket.c
conn/ssl.c
conn/ssl_gnutls.c
conn/tunnel.c
copy.c
curs_lib.c
curs_main.c
edit.c
enter.c
enter_state.h
envelope.c
group.c
handler.c
hcache/bdb.c
hcache/hcache.c
hcache/lmdb.c
header.c
history.c
hook.c
imap/auth_sasl.c
imap/browse.c
imap/command.c
imap/imap.c
imap/message.c
imap/utf7.c
imap/util.c
init.c
keymap.c
main.c
mbox.c
mbyte.c
menu.c
mh.c
mutt/buffer.c
mutt/file.c
mutt/hash.c
mutt/list.c
mutt/mbyte.c
mutt/memory.c
mutt/memory.h
mutt/string.c
mutt_idna.c
mutt_lua.c
mutt_notmuch.c
mutt_tags.c
muttlib.c
mx.c
ncrypt/crypt.c
ncrypt/crypt_gpgme.c
ncrypt/crypt_mod.c
ncrypt/gnupgparse.c
ncrypt/pgp.c
ncrypt/pgpkey.c
ncrypt/pgplib.c
ncrypt/pgplib.h
ncrypt/pgppacket.c
ncrypt/smime.c
newsrc.c
nntp.c
pager.c
parameter.h
parse.c
pattern.c
pattern.h
pgppubring.c
pop.c
pop_auth.c
pop_lib.c
query.c
recvattach.c
remailer.c
rfc1524.c
rfc2047.c
rfc2231.c
rfc822.c
rfc822.h
safe_asprintf.c
score.c
send.c
sendlib.c
sidebar.c
smtp.c
thread.c
url.c

index be6e56349447bbbe097805a72f4d12b87e104f7a..11405abb1dd2ab443c250ab4240227f22347dfcc 100644 (file)
@@ -173,7 +173,7 @@ new_aliases:
     menu->max++;
   }
 
-  safe_realloc(&AliasTable, menu->max * sizeof(struct Alias *));
+  mutt_mem_realloc(&AliasTable, menu->max * sizeof(struct Alias *));
   menu->data = AliasTable;
   if (!AliasTable)
     return;
diff --git a/alias.c b/alias.c
index 12a929ed4f75a8943ddbc2144195b9486cc5fb06..dc580a591c8a895cd9992f473981e3173d4984f6 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -336,7 +336,7 @@ retry_name:
     }
   }
 
-  new = safe_calloc(1, sizeof(struct Alias));
+  new = mutt_mem_calloc(1, sizeof(struct Alias));
   new->name = safe_strdup(buf);
 
   mutt_addrlist_to_local(adr);
@@ -548,10 +548,10 @@ int mutt_alias_complete(char *s, size_t buflen)
         if (a->name && (strstr(a->name, s) == a->name))
         {
           if (!a_list) /* init */
-            a_cur = a_list = safe_malloc(sizeof(struct Alias));
+            a_cur = a_list = mutt_mem_malloc(sizeof(struct Alias));
           else
           {
-            a_cur->next = safe_malloc(sizeof(struct Alias));
+            a_cur->next = mutt_mem_malloc(sizeof(struct Alias));
             a_cur = a_cur->next;
           }
           memcpy(a_cur, a, sizeof(struct Alias));
index 6358fb87031b6f66edfd3a72b79cc1a6e8c6a22b..92fde687f98f14df9ad37f13e438a89ae694d3a9 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -1139,8 +1139,8 @@ void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach)
   if (actx->idxlen == actx->idxmax)
   {
     actx->idxmax += 5;
-    safe_realloc(&actx->idx, sizeof(struct AttachPtr *) * actx->idxmax);
-    safe_realloc(&actx->v2r, sizeof(short) * actx->idxmax);
+    mutt_mem_realloc(&actx->idx, sizeof(struct AttachPtr *) * actx->idxmax);
+    mutt_mem_realloc(&actx->v2r, sizeof(short) * actx->idxmax);
     for (i = actx->idxlen; i < actx->idxmax; i++)
       actx->idx[i] = NULL;
   }
@@ -1155,7 +1155,7 @@ void mutt_actx_add_fp(struct AttachCtx *actx, FILE *new_fp)
   if (actx->fp_len == actx->fp_max)
   {
     actx->fp_max += 5;
-    safe_realloc(&actx->fp_idx, sizeof(FILE *) * actx->fp_max);
+    mutt_mem_realloc(&actx->fp_idx, sizeof(FILE *) * actx->fp_max);
     for (i = actx->fp_len; i < actx->fp_max; i++)
       actx->fp_idx[i] = NULL;
   }
@@ -1170,7 +1170,7 @@ void mutt_actx_add_body(struct AttachCtx *actx, struct Body *new_body)
   if (actx->body_len == actx->body_max)
   {
     actx->body_max += 5;
-    safe_realloc(&actx->body_idx, sizeof(struct Body *) * actx->body_max);
+    mutt_mem_realloc(&actx->body_idx, sizeof(struct Body *) * actx->body_max);
     for (i = actx->body_len; i < actx->body_max; i++)
       actx->body_idx[i] = NULL;
   }
index 1dd6bb8b1e868b0db4e4eadbf54b9f51755e5e9c..1f83a09a2c465aff04d63f39a13e0f5feb8b9fb9 100644 (file)
--- a/bcache.c
+++ b/bcache.c
@@ -111,7 +111,7 @@ struct BodyCache *mutt_bcache_open(struct Account *account, const char *mailbox)
   if (!account)
     goto bail;
 
-  bcache = safe_calloc(1, sizeof(struct BodyCache));
+  bcache = mutt_mem_calloc(1, sizeof(struct BodyCache));
   if (bcache_path(account, mailbox, bcache->path, sizeof(bcache->path)) < 0)
     goto bail;
   bcache->pathlen = mutt_strlen(bcache->path);
diff --git a/body.c b/body.c
index a1e02f91a9860f7f4fa8f169ba01b01006cb493c..272f58428c05c91eb19dae1cae4fdba1eb641dbe 100644 (file)
--- a/body.c
+++ b/body.c
@@ -35,7 +35,7 @@
 
 struct Body *mutt_new_body(void)
 {
-  struct Body *p = safe_calloc(1, sizeof(struct Body));
+  struct Body *p = mutt_mem_calloc(1, sizeof(struct Body));
 
   p->disposition = DISPATTACH;
   p->use_disp = true;
index dd661f7405fc2d3eb9e3201d15e140cdf774fa79..b68e0699d84174f24b5c1b9d69ef03a80dabe6ec 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -605,7 +605,7 @@ static void add_folder(struct Menu *m, struct BrowserState *state, const char *n
   if (state->entrylen == state->entrymax)
   {
     /* need to allocate more space */
-    safe_realloc(&state->entry, sizeof(struct FolderFile) * (state->entrymax += 256));
+    mutt_mem_realloc(&state->entry, sizeof(struct FolderFile) * (state->entrymax += 256));
     memset(&state->entry[state->entrylen], 0, sizeof(struct FolderFile) * 256);
     if (m)
       m->data = state->entry;
@@ -649,7 +649,7 @@ static void init_state(struct BrowserState *state, struct Menu *menu)
 {
   state->entrylen = 0;
   state->entrymax = 256;
-  state->entry = safe_calloc(state->entrymax, sizeof(struct FolderFile));
+  state->entry = mutt_mem_calloc(state->entrymax, sizeof(struct FolderFile));
 #ifdef USE_IMAP
   state->imap_browse = false;
 #endif
@@ -1475,7 +1475,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           if (menu->tagged)
           {
             *numfiles = menu->tagged;
-            tfiles = safe_calloc(*numfiles, sizeof(char *));
+            tfiles = mutt_mem_calloc(*numfiles, sizeof(char *));
             for (int j = 0, k = 0; j < state.entrylen; j++)
             {
               struct FolderFile ff = state.entry[j];
@@ -1492,7 +1492,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           else if (f[0]) /* no tagged entries. return selected entry */
           {
             *numfiles = 1;
-            tfiles = safe_calloc(*numfiles, sizeof(char *));
+            tfiles = mutt_mem_calloc(*numfiles, sizeof(char *));
             mutt_expand_path(f, flen);
             tfiles[0] = safe_strdup(f);
             *files = tfiles;
@@ -1684,7 +1684,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
         strfcpy(buf, NONULL(Mask.pattern), sizeof(buf));
         if (mutt_get_field(_("File Mask: "), buf, sizeof(buf), 0) == 0)
         {
-          regex_t *rx = safe_malloc(sizeof(regex_t));
+          regex_t *rx = mutt_mem_malloc(sizeof(regex_t));
           char *s = buf;
           int not = 0, err;
 
diff --git a/buffy.c b/buffy.c
index 97037c4df8afd55b1581b905f162db274954149f..5ad0d4e3efef10579fd25cee8486f7a0047185d8 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -160,7 +160,7 @@ static struct Buffy *buffy_new(const char *path)
   char rp[PATH_MAX] = "";
   char *r = NULL;
 
-  buffy = safe_calloc(1, sizeof(struct Buffy));
+  buffy = mutt_mem_calloc(1, sizeof(struct Buffy));
   strfcpy(buffy->path, path, sizeof(buffy->path));
   r = realpath(path, rp);
   strfcpy(buffy->realpath, r ? rp : path, sizeof(buffy->realpath));
index 267df735286d17ce692fd587098ab37bd6af67b2..ecf943fdc9a8aa8039e9bdcc01a68fb9da23e363 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -469,7 +469,7 @@ int mutt_convert_string(char **ps, const char *from, const char *to, int flags)
     ib = s;
     ibl = len + 1;
     obl = MB_LEN_MAX * ibl;
-    ob = buf = safe_malloc(obl + 1);
+    ob = buf = mutt_mem_malloc(obl + 1);
 
     mutt_iconv(cd, &ib, &ibl, &ob, &obl, inrepls, outrepl);
     iconv_close(cd);
@@ -533,14 +533,14 @@ FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags)
 
   if (cd != (iconv_t) -1)
   {
-    fc = safe_malloc(sizeof(struct FgetConv));
+    fc = mutt_mem_malloc(sizeof(struct FgetConv));
     fc->p = fc->ob = fc->bufo;
     fc->ib = fc->bufi;
     fc->ibl = 0;
     fc->inrepls = mutt_is_utf8(to) ? repls : repls + 1;
   }
   else
-    fc = safe_malloc(sizeof(struct FgetConvNot));
+    fc = mutt_mem_malloc(sizeof(struct FgetConvNot));
   fc->file = file;
   fc->cd = cd;
   return (FGETCONV *) fc;
diff --git a/color.c b/color.c
index a82f0f722738b09a456e37053d874ded81ca7d1b..ad381a74e986d9bed6268d6b0f59e0397d8c2697 100644 (file)
--- a/color.c
+++ b/color.c
@@ -149,7 +149,7 @@ static const struct Mapping ComposeFields[] = {
 
 static struct ColorLine *new_color_line(void)
 {
-  struct ColorLine *p = safe_calloc(1, sizeof(struct ColorLine));
+  struct ColorLine *p = mutt_mem_calloc(1, sizeof(struct ColorLine));
 
   p->fg = p->bg = -1;
 
@@ -179,7 +179,7 @@ static void free_color_line(struct ColorLine *tmp, int free_colors)
 void ci_start_color(void)
 {
   memset(ColorDefs, A_NORMAL, sizeof(int) * MT_COLOR_MAX);
-  ColorQuote = safe_malloc(COLOR_QUOTE_INIT * sizeof(int));
+  ColorQuote = mutt_mem_malloc(COLOR_QUOTE_INIT * sizeof(int));
   memset(ColorQuote, A_NORMAL, sizeof(int) * COLOR_QUOTE_INIT);
   ColorQuoteSize = COLOR_QUOTE_INIT;
   ColorQuoteUsed = 0;
@@ -281,7 +281,7 @@ int mutt_alloc_color(int fg, int bg)
     i++;
   }
 
-  p = safe_malloc(sizeof(struct ColorList));
+  p = mutt_mem_malloc(sizeof(struct ColorList));
   p->next = ColorList;
   ColorList = p;
 
@@ -940,7 +940,7 @@ static int parse_color(struct Buffer *buf, struct Buffer *s, struct Buffer *err,
   {
     if (q_level >= ColorQuoteSize)
     {
-      safe_realloc(&ColorQuote, (ColorQuoteSize += 2) * sizeof(int));
+      mutt_mem_realloc(&ColorQuote, (ColorQuoteSize += 2) * sizeof(int));
       ColorQuote[ColorQuoteSize - 2] = ColorDefs[MT_COLOR_QUOTED];
       ColorQuote[ColorQuoteSize - 1] = ColorDefs[MT_COLOR_QUOTED];
     }
index 488282113be1f91c48f82b22a792dbc059f7bf3a..d87a6cb790578c89be0f17909ac7466b72504008 100644 (file)
@@ -647,7 +647,7 @@ void mutt_enter_command(void)
     return;
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   mutt_buffer_init(&token);
   r = mutt_parse_rc_line(buffer, &token, &err);
   FREE(&token.data);
index af7d89471f9810882d4574437c6cea057eb5ba75..a1fcfeedbfdcd2463ea4ae0034b1db54529aae3c 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -534,7 +534,7 @@ static void mutt_gen_compose_attach_list(struct AttachCtx *actx, struct Body *m,
     }
     else
     {
-      new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
+      new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr));
       mutt_actx_add_attach(actx, new);
       new->content = m;
       m->aptr = new;
@@ -800,7 +800,7 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */
   menu->redraw_data = &rd;
   mutt_push_current_menu(menu);
 
-  actx = safe_calloc(sizeof(struct AttachCtx), 1);
+  actx = mutt_mem_calloc(sizeof(struct AttachCtx), 1);
   actx->hdr = msg;
   mutt_update_compose_menu(actx, menu, 1);
 
@@ -992,7 +992,7 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */
       case OP_COMPOSE_ATTACH_KEY:
         if (!(WithCrypto & APPLICATION_PGP))
           break;
-        new = safe_calloc(1, sizeof(struct AttachPtr));
+        new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
         new->content = crypt_pgp_make_key_attachment(NULL);
         if (new->content)
         {
@@ -1028,7 +1028,7 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */
         for (i = 0; i < numfiles; i++)
         {
           char *att = files[i];
-          new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
+          new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr));
           new->unowned = 1;
           new->content = mutt_make_file_attach(att);
           if (new->content)
@@ -1151,7 +1151,7 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */
           if (!message_is_tagged(Context, i))
             continue;
 
-          new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
+          new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr));
           new->content = mutt_make_message_attach(Context, Context->hdrs[i], 1);
           if (new->content != NULL)
             update_idx(menu, actx, new);
@@ -1427,7 +1427,7 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */
           mutt_error(_("Unknown Content-Type %s"), type);
           continue;
         }
-        new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
+        new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr));
         /* Touch the file */
         fp = mutt_file_fopen(fname, "w");
         if (!fp)
index b0ff20f3420b469c36696a464ee3911f56394f0c..104a5f55757d3a454c3b07cc94025fa57bce883a 100644 (file)
@@ -256,7 +256,7 @@ static struct CompressInfo *set_compress_info(struct Context *ctx)
   const char *c = find_hook(MUTT_CLOSEHOOK, ctx->path);
   const char *a = find_hook(MUTT_APPENDHOOK, ctx->path);
 
-  struct CompressInfo *ci = safe_calloc(1, sizeof(struct CompressInfo));
+  struct CompressInfo *ci = mutt_mem_calloc(1, sizeof(struct CompressInfo));
   ctx->compress_info = ci;
 
   ci->open = safe_strdup(o);
index 593a760793651a202ddaf98645a71b030d169ba6..0038f1d2c2e8556add5668b25493e3cf4c52f93a 100644 (file)
@@ -73,7 +73,7 @@ int getdnsdomainname(char *d, size_t len)
   int status;
   struct timespec timeout = { 0, 100000000 };
   struct gaicb *reqs[1];
-  reqs[0] = safe_calloc(1, sizeof(*reqs[0]));
+  reqs[0] = mutt_mem_calloc(1, sizeof(*reqs[0]));
   reqs[0]->ar_name = node;
   reqs[0]->ar_request = &hints;
   if (getaddrinfo_a(GAI_NOWAIT, reqs, 1, NULL) == 0)
index f71707f7b96358edb9be13df73befde308f44783..5cf046b21d2c8881fce9196adb9125753f1d9a06 100644 (file)
@@ -285,7 +285,7 @@ static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id, sasl_secr
 
   len = strlen(account->pass);
 
-  safe_realloc(&secret_ptr, sizeof(sasl_secret_t) + len);
+  mutt_mem_realloc(&secret_ptr, sizeof(sasl_secret_t) + len);
   memcpy((char *) secret_ptr->data, account->pass, (size_t) len);
   secret_ptr->len = len;
   *psecret = secret_ptr;
@@ -667,7 +667,7 @@ int mutt_sasl_interact(sasl_interact_t *interaction)
       return SASL_FAIL;
 
     interaction->len = mutt_strlen(resp) + 1;
-    interaction->result = safe_malloc(interaction->len);
+    interaction->result = mutt_mem_malloc(interaction->len);
     memcpy((char *) interaction->result, resp, interaction->len);
 
     interaction++;
@@ -686,7 +686,7 @@ int mutt_sasl_interact(sasl_interact_t *interaction)
  */
 void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn)
 {
-  struct SaslData *sasldata = safe_malloc(sizeof(struct SaslData));
+  struct SaslData *sasldata = mutt_mem_malloc(sizeof(struct SaslData));
   /* work around sasl_getprop aliasing issues */
   const void *tmp = NULL;
 
index c1d52c11846e298397a021075f3593af71a963c2..67192ed43a849b6fc36e9dd8d55e8a8355c171c2 100644 (file)
@@ -343,7 +343,7 @@ struct Connection *socket_new_conn(void)
 {
   struct Connection *conn = NULL;
 
-  conn = safe_calloc(1, sizeof(struct Connection));
+  conn = mutt_mem_calloc(1, sizeof(struct Connection));
   conn->fd = -1;
 
   return conn;
index 049f62b773e34f8d414575e0a54e46ee98bb9516..383c4d5897c7c64bb7c6186e1a71dafded60a0ed 100644 (file)
@@ -337,7 +337,7 @@ static void ssl_dprint_err_stack(void)
   buflen = BIO_get_mem_data(bio, &buf);
   if (buflen > 0)
   {
-    output = safe_malloc(buflen + 1);
+    output = mutt_mem_malloc(buflen + 1);
     memcpy(output, buf, buflen);
     output[buflen] = '\0';
     mutt_debug(1, "SSL error stack: %s\n", output);
@@ -886,7 +886,7 @@ static int check_host(X509 *x509cert, const char *hostname, char *err, size_t er
       goto out;
     }
     bufsize++; /* space for the terminal nul char */
-    buf = safe_malloc((size_t) bufsize);
+    buf = mutt_mem_malloc((size_t) bufsize);
     if (X509_NAME_get_text_by_NID(x509_subject, NID_commonName, buf, bufsize) == -1)
     {
       if (err && errlen)
@@ -977,9 +977,9 @@ static int interactive_check_cert(X509 *cert, int idx, int len, SSL *ssl, int al
   mutt_push_current_menu(menu);
 
   menu->max = mutt_array_size(part) * 2 + 10;
-  menu->dialog = safe_calloc(1, menu->max * sizeof(char *));
+  menu->dialog = mutt_mem_calloc(1, menu->max * sizeof(char *));
   for (int i = 0; i < menu->max; i++)
-    menu->dialog[i] = safe_calloc(1, SHORT_STRING * sizeof(char));
+    menu->dialog[i] = mutt_mem_calloc(1, SHORT_STRING * sizeof(char));
 
   row = 0;
   strfcpy(menu->dialog[row], _("This certificate belongs to:"), SHORT_STRING);
@@ -1338,7 +1338,7 @@ static int ssl_socket_open(struct Connection *conn)
   if (raw_socket_open(conn) < 0)
     return -1;
 
-  data = safe_calloc(1, sizeof(struct SslSockData));
+  data = mutt_mem_calloc(1, sizeof(struct SslSockData));
   conn->sockdata = data;
 
   data->ctx = SSL_CTX_new(SSLv23_client_method());
@@ -1441,7 +1441,7 @@ int mutt_ssl_starttls(struct Connection *conn)
   if (ssl_init())
     goto bail;
 
-  ssldata = safe_calloc(1, sizeof(struct SslSockData));
+  ssldata = mutt_mem_calloc(1, sizeof(struct SslSockData));
   /* the ssl_use_xxx protocol options don't apply. We must use TLS in TLS.
    *
    * However, we need to be able to negotiate amongst various TLS versions,
index 1379750fe9203925ed4cb21e3a83978729c1ddae..80cc5ed17be8a199771292c8ce89f5dfafeb4fd8 100644 (file)
@@ -378,7 +378,7 @@ static int tls_compare_certificates(const gnutls_datum_t *peercert)
     return 0;
 
   b64_data.size = filestat.st_size + 1;
-  b64_data_data = safe_calloc(1, b64_data.size);
+  b64_data_data = mutt_mem_calloc(1, b64_data.size);
   b64_data_data[b64_data.size - 1] = '\0';
   b64_data.data = b64_data_data;
 
@@ -649,9 +649,9 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata,
 
   menu = mutt_new_menu(MENU_GENERIC);
   menu->max = 25;
-  menu->dialog = safe_calloc(1, menu->max * sizeof(char *));
+  menu->dialog = mutt_mem_calloc(1, menu->max * sizeof(char *));
   for (int i = 0; i < menu->max; i++)
-    menu->dialog[i] = safe_calloc(1, SHORT_STRING * sizeof(char));
+    menu->dialog[i] = mutt_mem_calloc(1, SHORT_STRING * sizeof(char));
   mutt_push_current_menu(menu);
 
   row = 0;
@@ -1037,7 +1037,7 @@ static int tls_set_priority(struct TlsSockData *data)
   int err;
 
   priority_size = SHORT_STRING + mutt_strlen(SslCiphers);
-  priority = safe_malloc(priority_size);
+  priority = mutt_mem_malloc(priority_size);
 
   priority[0] = 0;
   if (SslCiphers)
@@ -1142,7 +1142,7 @@ static int tls_negotiate(struct Connection *conn)
   struct TlsSockData *data = NULL;
   int err;
 
-  data = safe_calloc(1, sizeof(struct TlsSockData));
+  data = mutt_mem_calloc(1, sizeof(struct TlsSockData));
   conn->sockdata = data;
   err = gnutls_certificate_allocate_credentials(&data->xcred);
   if (err < 0)
index e0871205ce2d48daa2b54a65f0273ec0221e4e9a..57fcc49f4cd5f2e5a16c97dd22f9e752bd7389d5 100644 (file)
@@ -76,7 +76,7 @@ static int tunnel_socket_open(struct Connection *conn)
   int pin[2], pout[2];
   int devnull;
 
-  tunnel = safe_malloc(sizeof(struct TunnelData));
+  tunnel = mutt_mem_malloc(sizeof(struct TunnelData));
   conn->sockdata = tunnel;
 
   mutt_message(_("Connecting with \"%s\"..."), Tunnel);
diff --git a/copy.c b/copy.c
index 7dfe711389d9aeb548181d3440eefc4251997a18..86d3c35903d805b8ff51330b4d1701e0602cbc33 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -157,7 +157,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
 
   mutt_debug(1, "WEED is %s\n", (flags & CH_WEED) ? "Set" : "Not");
 
-  headers = safe_calloc(hdr_count, sizeof(char *));
+  headers = mutt_mem_calloc(hdr_count, sizeof(char *));
 
   /* Read all the headers into the array */
   while (ftello(in) < off_end)
@@ -195,7 +195,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
         {
           int hlen = mutt_strlen(headers[x]);
 
-          safe_realloc(&headers[x], hlen + this_one_len + sizeof(char));
+          mutt_mem_realloc(&headers[x], hlen + this_one_len + sizeof(char));
           strcat(headers[x] + hlen, this_one);
           FREE(&this_one);
         }
@@ -270,7 +270,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
       {
         int blen = mutt_strlen(buf);
 
-        safe_realloc(&this_one, this_one_len + blen + sizeof(char));
+        mutt_mem_realloc(&this_one, this_one_len + blen + sizeof(char));
         strcat(this_one + this_one_len, buf);
         this_one_len += blen;
       }
@@ -293,7 +293,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
     {
       int hlen = mutt_strlen(headers[x]);
 
-      safe_realloc(&headers[x], hlen + this_one_len + sizeof(char));
+      mutt_mem_realloc(&headers[x], hlen + this_one_len + sizeof(char));
       strcat(headers[x] + hlen, this_one);
       FREE(&this_one);
     }
@@ -899,7 +899,7 @@ static void format_address_header(char **h, struct Address *a)
   plen = linelen;
   buflen = linelen + 3;
 
-  safe_realloc(h, buflen);
+  mutt_mem_realloc(h, buflen);
   for (int count = 0; a; a = a->next, count++)
   {
     struct Address *tmp = a->next;
@@ -932,7 +932,7 @@ static void format_address_header(char **h, struct Address *a)
     cbuflen = mutt_strlen(cbuf);
     c2buflen = mutt_strlen(c2buf);
     buflen += l + cbuflen + c2buflen;
-    safe_realloc(h, buflen);
+    mutt_mem_realloc(h, buflen);
     p = *h;
     strcat(p + plen, cbuf);
     plen += cbuflen;
@@ -1034,7 +1034,7 @@ static int address_header_decode(char **h)
     *h = safe_strdup(s);
   else
   {
-    *h = safe_calloc(1, l + 2);
+    *h = mutt_mem_calloc(1, l + 2);
     strfcpy(*h, s, l + 1);
     format_address_header(h, a);
   }
index 2daa0da85146831960e6831764d10ecf3c8e5052..3c4ba2ecd6aca6919014073e7e0e027a31560252 100644 (file)
@@ -618,12 +618,12 @@ out:
 
 void mutt_init_windows(void)
 {
-  MuttHelpWindow = safe_calloc(1, sizeof(struct MuttWindow));
-  MuttIndexWindow = safe_calloc(1, sizeof(struct MuttWindow));
-  MuttStatusWindow = safe_calloc(1, sizeof(struct MuttWindow));
-  MuttMessageWindow = safe_calloc(1, sizeof(struct MuttWindow));
+  MuttHelpWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+  MuttIndexWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+  MuttStatusWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+  MuttMessageWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
 #ifdef USE_SIDEBAR
-  MuttSidebarWindow = safe_calloc(1, sizeof(struct MuttWindow));
+  MuttSidebarWindow = mutt_mem_calloc(1, sizeof(struct MuttWindow));
 #endif
 }
 
@@ -931,7 +931,7 @@ int mutt_enter_fname_full(const char *prompt, char *buf, size_t blen, int buffy,
   }
   else
   {
-    char *pc = safe_malloc(mutt_strlen(prompt) + 3);
+    char *pc = mutt_mem_malloc(mutt_strlen(prompt) + 3);
 
     sprintf(pc, "%s: ", prompt);
     mutt_unget_event(ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
@@ -956,7 +956,7 @@ void mutt_unget_event(int ch, int op)
   tmp.op = op;
 
   if (UngetCount >= UngetLen)
-    safe_realloc(&UngetKeyEvents, (UngetLen += 16) * sizeof(struct Event));
+    mutt_mem_realloc(&UngetKeyEvents, (UngetLen += 16) * sizeof(struct Event));
 
   UngetKeyEvents[UngetCount++] = tmp;
 }
@@ -985,7 +985,7 @@ void mutt_push_macro_event(int ch, int op)
   tmp.op = op;
 
   if (MacroBufferCount >= MacroBufferLen)
-    safe_realloc(&MacroEvents, (MacroBufferLen += 128) * sizeof(struct Event));
+    mutt_mem_realloc(&MacroEvents, (MacroBufferLen += 128) * sizeof(struct Event));
 
   MacroEvents[MacroBufferCount++] = tmp;
 }
index 687f51e6478711b190403c8b948a743f3733ae15..5c1d1ab3ad75f7fecb708679016df0ab8c24e51d 100644 (file)
@@ -372,7 +372,7 @@ void update_index(struct Menu *menu, struct Context *ctx, int check, int oldcoun
   if (option(OPT_UNCOLLAPSE_NEW) && oldcount && check != MUTT_REOPENED &&
       ((Sort & SORT_MASK) == SORT_THREADS))
   {
-    save_new = safe_malloc(sizeof(struct Header *) * (ctx->msgcount - oldcount));
+    save_new = mutt_mem_malloc(sizeof(struct Header *) * (ctx->msgcount - oldcount));
     for (int i = oldcount; i < ctx->msgcount; i++)
       save_new[i - oldcount] = ctx->hdrs[i];
   }
@@ -730,7 +730,7 @@ void mutt_draw_statusline(int cols, const char *buf, int buflen)
       if (!found)
       {
         chunks++;
-        safe_realloc(&syntax, chunks * sizeof(struct Syntax));
+        mutt_mem_realloc(&syntax, chunks * sizeof(struct Syntax));
       }
 
       i = chunks - 1;
diff --git a/edit.c b/edit.c
index 6027e64eca79943c0ddb16aa5a763394328afc08..5ba30d953a1951ba2d5e1b7d44f61b8015d8cc51 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -96,12 +96,12 @@ static char **be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen,
       break;
     bytes -= mutt_strlen(p);
     if (*bufmax == *buflen)
-      safe_realloc(&buf, sizeof(char *) * (*bufmax += 25));
+      mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
     buf[(*buflen)++] = safe_strdup(tmp);
   }
   if (buf && *bufmax == *buflen)
   { /* Do not smash memory past buf */
-    safe_realloc(&buf, sizeof(char *) * (++*bufmax));
+    mutt_mem_realloc(&buf, sizeof(char *) * (++*bufmax));
   }
   if (buf)
     buf[*buflen] = NULL;
@@ -182,7 +182,7 @@ static char **be_include_messages(char *msg, char **buf, int *bufmax,
       }
 
       if (*bufmax == *buflen)
-        safe_realloc(&buf, sizeof(char *) * (*bufmax += 25));
+        mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
       buf[(*buflen)++] = safe_strdup(tmp);
 
       bytes = Context->hdrs[n]->content->length;
@@ -196,7 +196,7 @@ static char **be_include_messages(char *msg, char **buf, int *bufmax,
       buf = be_snarf_data(Context->fp, buf, bufmax, buflen, offset, bytes, pfx);
 
       if (*bufmax == *buflen)
-        safe_realloc(&buf, sizeof(char *) * (*bufmax += 25));
+        mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
       buf[(*buflen)++] = safe_strdup("\n");
     }
     else
@@ -494,7 +494,7 @@ int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur
     {
       safe_strcat(tmp, sizeof(tmp), "\n");
       if (buflen == bufmax)
-        safe_realloc(&buf, sizeof(char *) * (bufmax += 25));
+        mutt_mem_realloc(&buf, sizeof(char *) * (bufmax += 25));
       buf[buflen++] = safe_strdup(tmp[1] == '~' ? tmp + 1 : tmp);
     }
 
diff --git a/enter.c b/enter.c
index c5ff00cd2c886204ce6d328783d7532d85369275..ae231ab35dc12fd0411ada8b8e82844e7da267eb 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -76,7 +76,7 @@ static void replace_part(struct EnterState *state, size_t from, char *buf)
 
   if (savelen)
   {
-    savebuf = safe_calloc(savelen, sizeof(wchar_t));
+    savebuf = mutt_mem_calloc(savelen, sizeof(wchar_t));
     memcpy(savebuf, state->wbuf + state->curpos, savelen * sizeof(wchar_t));
   }
 
@@ -89,7 +89,7 @@ static void replace_part(struct EnterState *state, size_t from, char *buf)
     if (state->curpos + savelen > state->wbuflen)
     {
       state->wbuflen = state->curpos + savelen;
-      safe_realloc(&state->wbuf, state->wbuflen * sizeof(wchar_t));
+      mutt_mem_realloc(&state->wbuf, state->wbuflen * sizeof(wchar_t));
     }
 
     /* Restore suffix */
@@ -478,7 +478,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
             if (!mutt_complete(buf, buflen))
             {
               templen = state->lastchar - i;
-              safe_realloc(&tempbuf, templen * sizeof(wchar_t));
+              mutt_mem_realloc(&tempbuf, templen * sizeof(wchar_t));
             }
             else
               BEEP();
@@ -597,7 +597,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
             if (!mutt_complete(buf, buflen))
             {
               templen = state->lastchar;
-              safe_realloc(&tempbuf, templen * sizeof(wchar_t));
+              mutt_mem_realloc(&tempbuf, templen * sizeof(wchar_t));
               memcpy(tempbuf, state->wbuf, templen * sizeof(wchar_t));
             }
             else
@@ -709,7 +709,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
         {
           char **tfiles = NULL;
           *numfiles = 1;
-          tfiles = safe_calloc(*numfiles, sizeof(char *));
+          tfiles = mutt_mem_calloc(*numfiles, sizeof(char *));
           mutt_expand_path(buf, buflen);
           tfiles[0] = safe_strdup(buf);
           *files = tfiles;
@@ -722,7 +722,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
         if (state->lastchar >= state->wbuflen)
         {
           state->wbuflen = state->lastchar + 20;
-          safe_realloc(&state->wbuf, state->wbuflen * sizeof(wchar_t));
+          mutt_mem_realloc(&state->wbuf, state->wbuflen * sizeof(wchar_t));
         }
         memmove(state->wbuf + state->curpos + 1, state->wbuf + state->curpos,
                 (state->lastchar - state->curpos) * sizeof(wchar_t));
index c4d2474e960f4e653e53690ca070526ae3fd6491..b52d45ba043dcc176563b23ec637a94ef3fcd820 100644 (file)
@@ -41,7 +41,7 @@ struct EnterState
 
 static inline struct EnterState *mutt_new_enter_state(void)
 {
-  return safe_calloc(1, sizeof(struct EnterState));
+  return mutt_mem_calloc(1, sizeof(struct EnterState));
 }
 
 #endif /* _MUTT_ENTER_STATE_H */
index 1e36ba264557738fdaafb8ea0cd5e4290f7c88ce..88d2f280b9be6bb542cffcaf39d2552cf94da2b9 100644 (file)
@@ -46,7 +46,7 @@
  */
 struct Envelope *mutt_new_envelope(void)
 {
-  struct Envelope *e = safe_calloc(1, sizeof(struct Envelope));
+  struct Envelope *e = mutt_mem_calloc(1, sizeof(struct Envelope));
   STAILQ_INIT(&e->references);
   STAILQ_INIT(&e->in_reply_to);
   STAILQ_INIT(&e->userhdrs);
diff --git a/group.c b/group.c
index 909d128c0af45a81bcc0397032cc24d68d2dff39..faf8fd0429c0076d562719de47b7c5eb7d729751 100644 (file)
--- a/group.c
+++ b/group.c
@@ -42,7 +42,7 @@ struct Group *mutt_pattern_group(const char *k)
   if (!p)
   {
     mutt_debug(2, "mutt_pattern_group: Creating group %s.\n", k);
-    p = safe_calloc(1, sizeof(struct Group));
+    p = mutt_mem_calloc(1, sizeof(struct Group));
     p->name = safe_strdup(k);
     mutt_hash_insert(Groups, p->name, p);
   }
@@ -88,7 +88,7 @@ void mutt_group_context_add(struct GroupContext **ctx, struct Group *group)
       return;
   }
 
-  *ctx = safe_calloc(1, sizeof(struct GroupContext));
+  *ctx = mutt_mem_calloc(1, sizeof(struct GroupContext));
   (*ctx)->g = group;
 }
 
index aff2cde2330b000e06157c08750ae0e6c3cace14..85fd2d6e1a8edcdd0a14cbe9a874676c4ba9eac7 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -613,7 +613,7 @@ static void enriched_flush(struct EnrichedState *stte, int wrap)
     if (stte->line_used > stte->line_max)
     {
       stte->line_max = stte->line_used;
-      safe_realloc(&stte->line, (stte->line_max + 1) * sizeof(wchar_t));
+      mutt_mem_realloc(&stte->line, (stte->line_max + 1) * sizeof(wchar_t));
     }
     wcscat(stte->line, stte->buffer);
     stte->line_len += stte->word_len;
@@ -632,7 +632,7 @@ static void enriched_putwc(wchar_t c, struct EnrichedState *stte)
     if (stte->tag_level[RICH_COLOR])
     {
       if (stte->param_used + 1 >= stte->param_len)
-        safe_realloc(&stte->param, (stte->param_len += STRING) * sizeof(wchar_t));
+        mutt_mem_realloc(&stte->param, (stte->param_len += STRING) * sizeof(wchar_t));
 
       stte->param[stte->param_used++] = c;
     }
@@ -643,7 +643,7 @@ static void enriched_putwc(wchar_t c, struct EnrichedState *stte)
   if (stte->buff_len < stte->buff_used + 3)
   {
     stte->buff_len += LONG_STRING;
-    safe_realloc(&stte->buffer, (stte->buff_len + 1) * sizeof(wchar_t));
+    mutt_mem_realloc(&stte->buffer, (stte->buff_len + 1) * sizeof(wchar_t));
   }
 
   if ((!stte->tag_level[RICH_NOFILL] && iswspace(c)) || c == (wchar_t) '\0')
@@ -698,7 +698,7 @@ static void enriched_puts(const char *s, struct EnrichedState *stte)
   if (stte->buff_len < stte->buff_used + mutt_strlen(s))
   {
     stte->buff_len += LONG_STRING;
-    safe_realloc(&stte->buffer, (stte->buff_len + 1) * sizeof(wchar_t));
+    mutt_mem_realloc(&stte->buffer, (stte->buff_len + 1) * sizeof(wchar_t));
   }
   c = s;
   while (*c)
@@ -814,8 +814,8 @@ static int text_enriched_handler(struct Body *a, struct State *s)
            (MuttIndexWindow->cols - 4) :
            ((MuttIndexWindow->cols - 4) < 72) ? (MuttIndexWindow->cols - 4) : 72);
   stte.line_max = stte.wrap_margin * 4;
-  stte.line = safe_calloc(1, (stte.line_max + 1) * sizeof(wchar_t));
-  stte.param = safe_calloc(1, (STRING) * sizeof(wchar_t));
+  stte.line = mutt_mem_calloc(1, (stte.line_max + 1) * sizeof(wchar_t));
+  stte.param = mutt_mem_calloc(1, (STRING) * sizeof(wchar_t));
 
   stte.param_len = STRING;
   stte.param_used = 0;
index 830eeab58dcd788afa3c058c0f14340def76d4bd..1f9d594dcafc8e4dc5556e06719bc622af8de123 100644 (file)
@@ -77,7 +77,7 @@ static void *hcache_bdb_open(const char *path)
   u_int32_t createflags = DB_CREATE;
   int pagesize;
 
-  struct HcacheDbCtx *ctx = safe_malloc(sizeof(struct HcacheDbCtx));
+  struct HcacheDbCtx *ctx = mutt_mem_malloc(sizeof(struct HcacheDbCtx));
 
   if (mutt_atoi(HeaderCachePageSize, &pagesize) < 0 || pagesize <= 0)
     pagesize = 16384;
index 906bd9a354908d9f4dd072414c4a334b81e305f0..d9f4377df7108182dd70c4cbba4fe3e12b9758d8 100644 (file)
@@ -140,7 +140,7 @@ static void *lazy_malloc(size_t siz)
   if (siz < 4096)
     siz = 4096;
 
-  return safe_malloc(siz);
+  return mutt_mem_malloc(siz);
 }
 
 static void lazy_realloc(void *ptr, size_t siz)
@@ -150,7 +150,7 @@ static void lazy_realloc(void *ptr, size_t siz)
   if (p != NULL && siz < 4096)
     return;
 
-  safe_realloc(ptr, siz);
+  mutt_mem_realloc(ptr, siz);
 }
 
 static unsigned char *dump_int(unsigned int i, unsigned char *d, int *off)
@@ -217,7 +217,7 @@ static void restore_char(char **c, const unsigned char *d, int *off, bool conver
     return;
   }
 
-  *c = safe_malloc(size);
+  *c = mutt_mem_malloc(size);
   memcpy(*c, d + *off, size);
   if (convert && !is_ascii(*c, size))
   {
@@ -336,7 +336,7 @@ static void restore_buffer(struct Buffer **b, const unsigned char *d, int *off,
     return;
   }
 
-  *b = safe_malloc(sizeof(struct Buffer));
+  *b = mutt_mem_malloc(sizeof(struct Buffer));
 
   restore_char(&(*b)->data, d, off, convert);
   restore_int(&offset, d, off);
@@ -377,7 +377,7 @@ static void restore_parameter(struct Parameter **p, const unsigned char *d,
 
   while (counter)
   {
-    *p = safe_malloc(sizeof(struct Parameter));
+    *p = mutt_mem_malloc(sizeof(struct Parameter));
     restore_char(&(*p)->attribute, d, off, false);
     restore_char(&(*p)->value, d, off, convert);
     p = &(*p)->next;
@@ -726,7 +726,7 @@ static char *get_foldername(const char *folder)
 
   /* if the folder is local, canonify the path to avoid
    * to ensure equivalent paths share the hcache */
-  p = safe_malloc(PATH_MAX + 1);
+  p = mutt_mem_malloc(PATH_MAX + 1);
   if (!realpath(path, p))
     mutt_str_replace(&p, path);
 
@@ -739,7 +739,7 @@ header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_na
   if (!ops)
     return NULL;
 
-  header_cache_t *h = safe_calloc(1, sizeof(header_cache_t));
+  header_cache_t *h = mutt_mem_calloc(1, sizeof(header_cache_t));
 
   /* Calculate the current hcache version from dynamic configuration */
   if (hcachever == 0x0)
index 50698e87358d61e043e8a74d00780d8d05f98d77..512fae10e59ca37149a9c768fd3d00d267a6a5d9 100644 (file)
@@ -108,7 +108,7 @@ static void *hcache_lmdb_open(const char *path)
 {
   int rc;
 
-  struct HcacheLmdbCtx *ctx = safe_calloc(1, sizeof(struct HcacheLmdbCtx));
+  struct HcacheLmdbCtx *ctx = mutt_mem_calloc(1, sizeof(struct HcacheLmdbCtx));
 
   rc = mdb_env_create(&ctx->env);
   if (rc != MDB_SUCCESS)
index 01b8a252ce5bb325f87151ea75d13c197a240c71..7170326e8d6c01d1a4052168289fb2ad0783cc6a 100644 (file)
--- a/header.c
+++ b/header.c
@@ -378,7 +378,7 @@ void mutt_free_header(struct Header **h)
 
 struct Header *mutt_new_header(void)
 {
-  struct Header *h = safe_calloc(1, sizeof(struct Header));
+  struct Header *h = mutt_mem_calloc(1, sizeof(struct Header));
 #ifdef MIXMASTER
   STAILQ_INIT(&h->chain);
 #endif
index 1f05d5fcf666fae373df9b8b93fa774515587c06..29069d4eeadaa576b9b3ecac2a9bfb2ea2d8174d 100644 (file)
--- a/history.c
+++ b/history.c
@@ -107,7 +107,7 @@ static void init_history(struct History *h)
   }
 
   if (History)
-    h->hist = safe_calloc(History + 1, sizeof(char *));
+    h->hist = mutt_mem_calloc(History + 1, sizeof(char *));
 
   h->cur = 0;
   h->last = 0;
diff --git a/hook.c b/hook.c
index 98c355ee9228e3d459a0648c51a9936e60e89d88..5d97ff78a93debabfa36aac4849d58f25cdc2cee 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -226,7 +226,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
   else if (~data & MUTT_GLOBALHOOK) /* NOT a global hook */
   {
     /* Hooks not allowing full patterns: Check syntax of regex */
-    rx = safe_malloc(sizeof(regex_t));
+    rx = mutt_mem_malloc(sizeof(regex_t));
 #ifdef MUTT_CRYPTHOOK
     if ((rc = REGCOMP(rx, NONULL(pattern.data),
                       ((data & (MUTT_CRYPTHOOK | MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0))) != 0)
@@ -241,7 +241,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     }
   }
 
-  ptr = safe_calloc(1, sizeof(struct Hook));
+  ptr = mutt_mem_calloc(1, sizeof(struct Hook));
   ptr->type = data;
   ptr->command = command.data;
   ptr->pattern = pat;
@@ -337,7 +337,7 @@ void mutt_folder_hook(const char *path)
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   mutt_buffer_init(&token);
   TAILQ_FOREACH(tmp, &Hooks, entries)
   {
@@ -392,7 +392,7 @@ void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type)
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   mutt_buffer_init(&token);
   memset(&cache, 0, sizeof(cache));
   TAILQ_FOREACH(hook, &Hooks, entries)
@@ -557,7 +557,7 @@ void mutt_account_hook(const char *url)
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   mutt_buffer_init(&token);
 
   TAILQ_FOREACH(hook, &Hooks, entries)
index 134cb2900469c7fde34cb3c32f7bb011871dd48b..b4d3661f944b4bcec8b08f7f5c89100dd7192f6e 100644 (file)
@@ -120,7 +120,7 @@ enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method)
   mutt_message(_("Authenticating (%s)..."), mech);
 
   bufsize = ((olen * 2) > LONG_STRING) ? (olen * 2) : LONG_STRING;
-  buf = safe_malloc(bufsize);
+  buf = mutt_mem_malloc(bufsize);
 
   snprintf(buf, bufsize, "AUTHENTICATE %s", mech);
   if (mutt_bit_isset(idata->capabilities, SASL_IR) && client_start)
@@ -162,7 +162,7 @@ enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method)
         if (len > bufsize)
         {
           bufsize = len;
-          safe_realloc(&buf, bufsize);
+          mutt_mem_realloc(&buf, bufsize);
         }
         /* For sasl_decode64, the fourth parameter, outmax, doesn't
          * include space for the trailing null */
@@ -196,7 +196,7 @@ enum ImapAuthRes imap_auth_sasl(struct ImapData *idata, const char *method)
       if ((olen * 2) > bufsize)
       {
         bufsize = olen * 2;
-        safe_realloc(&buf, bufsize);
+        mutt_mem_realloc(&buf, bufsize);
       }
       if (sasl_encode64(pc, olen, buf, bufsize, &olen) != SASL_OK)
       {
index 333aa0032e74ecce6dabc5e1b789fef40b831578..f8f46bfcf106a1c3bb9c547ca84be3028efbe47e 100644 (file)
@@ -79,7 +79,7 @@ static void add_folder(char delim, char *folder, int noselect, int noinferiors,
 
   if (state->entrylen + 1 == state->entrymax)
   {
-    safe_realloc(&state->entry, sizeof(struct FolderFile) * (state->entrymax += 256));
+    mutt_mem_realloc(&state->entry, sizeof(struct FolderFile) * (state->entrymax += 256));
     memset(state->entry + state->entrylen, 0,
            (sizeof(struct FolderFile) * (state->entrymax - state->entrylen)));
   }
index c02f3e2dcfc84a4c0a8c7b2e51662e6c7c37ccb4..26ce6301e89a683260f23cb93f937580b387eb2b 100644 (file)
@@ -943,7 +943,7 @@ int imap_cmd_step(struct ImapData *idata)
   {
     if (len == idata->blen)
     {
-      safe_realloc(&idata->buf, idata->blen + IMAP_CMD_BUFSIZE);
+      mutt_mem_realloc(&idata->buf, idata->blen + IMAP_CMD_BUFSIZE);
       idata->blen = idata->blen + IMAP_CMD_BUFSIZE;
       mutt_debug(3, "imap_cmd_step: grew buffer to %u bytes\n", idata->blen);
     }
@@ -969,7 +969,7 @@ int imap_cmd_step(struct ImapData *idata)
   /* don't let one large string make cmd->buf hog memory forever */
   if ((idata->blen > IMAP_CMD_BUFSIZE) && (len <= IMAP_CMD_BUFSIZE))
   {
-    safe_realloc(&idata->buf, IMAP_CMD_BUFSIZE);
+    mutt_mem_realloc(&idata->buf, IMAP_CMD_BUFSIZE);
     idata->blen = IMAP_CMD_BUFSIZE;
     mutt_debug(3, "imap_cmd_step: shrank buffer to %u bytes\n", idata->blen);
   }
index 1b5d0cb39a09798366ea68ebf115e577391dbec2..7792caae4415e8728add19b5cebace59052cf433 100644 (file)
@@ -1231,7 +1231,7 @@ int imap_exec_msgset(struct ImapData *idata, const char *pre, const char *post,
   if (Sort != SORT_ORDER)
   {
     hdrs = idata->ctx->hdrs;
-    idata->ctx->hdrs = safe_malloc(idata->ctx->msgcount * sizeof(struct Header *));
+    idata->ctx->hdrs = mutt_mem_malloc(idata->ctx->msgcount * sizeof(struct Header *));
     memcpy(idata->ctx->hdrs, hdrs, idata->ctx->msgcount * sizeof(struct Header *));
 
     Sort = SORT_ORDER;
@@ -1644,7 +1644,7 @@ struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox,
   /* lame */
   if (create)
   {
-    struct ImapStatus *scache = safe_calloc(1, sizeof(struct ImapStatus));
+    struct ImapStatus *scache = mutt_mem_calloc(1, sizeof(struct ImapStatus));
     scache->name = (char *) mbox;
     mutt_list_insert_tail(&idata->mboxcache, (char *) scache);
     status = imap_mboxcache_get(idata, mbox, 0);
@@ -2213,8 +2213,8 @@ static int imap_open_mailbox(struct Context *ctx)
     ctx->readonly = true;
 
   ctx->hdrmax = count;
-  ctx->hdrs = safe_calloc(count, sizeof(struct Header *));
-  ctx->v2r = safe_calloc(count, sizeof(int));
+  ctx->hdrs = mutt_mem_calloc(count, sizeof(struct Header *));
+  ctx->v2r = mutt_mem_calloc(count, sizeof(int));
   ctx->msgcount = 0;
 
   if (count && (imap_read_headers(idata, 1, count) < 0))
@@ -2500,7 +2500,7 @@ int imap_sync_mailbox(struct Context *ctx, int expunge)
   if (Sort != SORT_ORDER)
   {
     hdrs = ctx->hdrs;
-    ctx->hdrs = safe_malloc(ctx->msgcount * sizeof(struct Header *));
+    ctx->hdrs = mutt_mem_malloc(ctx->msgcount * sizeof(struct Header *));
     memcpy(ctx->hdrs, hdrs, ctx->msgcount * sizeof(struct Header *));
 
     Sort = SORT_ORDER;
index 9bce11f2c5d0d98284f8626769424a3f3fac909b..71bb35fde667d91adbff1b0a6969af1425c26189 100644 (file)
@@ -77,7 +77,7 @@
  */
 static struct ImapHeaderData *new_header_data(void)
 {
-  struct ImapHeaderData *d = safe_calloc(1, sizeof(struct ImapHeaderData));
+  struct ImapHeaderData *d = mutt_mem_calloc(1, sizeof(struct ImapHeaderData));
   return d;
 }
 
@@ -492,10 +492,10 @@ static void alloc_msn_index(struct ImapData *idata, unsigned int msn_count)
   new_size = msn_count + 25;
 
   if (!idata->msn_index)
-    idata->msn_index = safe_calloc(new_size, sizeof(struct Header *));
+    idata->msn_index = mutt_mem_calloc(new_size, sizeof(struct Header *));
   else
   {
-    safe_realloc(&idata->msn_index, sizeof(struct Header *) * new_size);
+    mutt_mem_realloc(&idata->msn_index, sizeof(struct Header *) * new_size);
     memset(idata->msn_index + idata->msn_index_size, 0,
            sizeof(struct Header *) * (new_size - idata->msn_index_size));
   }
index a944ca522dfe8af7fac4f405894d8aeed1a8c928..421005716f19fbaadc1016d18e7d41a186096077 100644 (file)
@@ -91,7 +91,7 @@ static char *utf7_to_utf8(const char *u7, size_t u7len, char **u8, size_t *u8len
   char *buf = NULL, *p = NULL;
   int b, ch, k;
 
-  p = buf = safe_malloc(u7len + u7len / 8 + 1);
+  p = buf = mutt_mem_malloc(u7len + u7len / 8 + 1);
 
   for (; u7len; u7++, u7len--)
   {
@@ -162,7 +162,7 @@ static char *utf7_to_utf8(const char *u7, size_t u7len, char **u8, size_t *u8len
   if (u8len)
     *u8len = p - buf;
 
-  safe_realloc(&buf, p - buf);
+  mutt_mem_realloc(&buf, p - buf);
   if (u8)
     *u8 = buf;
   return buf;
@@ -197,7 +197,7 @@ static char *utf8_to_utf7(const char *u8, size_t u8len, char **u7, size_t *u7len
    * In the worst case we convert 2 chars to 7 chars. For example:
    * "\x10&\x10&..." -> "&ABA-&-&ABA-&-...".
    */
-  p = buf = safe_malloc((u8len / 2) * 7 + 6);
+  p = buf = mutt_mem_malloc((u8len / 2) * 7 + 6);
 
   while (u8len)
   {
@@ -302,7 +302,7 @@ static char *utf8_to_utf7(const char *u8, size_t u8len, char **u7, size_t *u7len
   *p++ = '\0';
   if (u7len)
     *u7len = p - buf;
-  safe_realloc(&buf, p - buf);
+  mutt_mem_realloc(&buf, p - buf);
   if (u7)
     *u7 = buf;
   return buf;
index 098b41c90406f3d973f49184d587c306c9884425..a55313e997b50ca752cf0985d0603a15ce8104dc 100644 (file)
@@ -509,8 +509,8 @@ int imap_mxcmp(const char *mx1, const char *mx2)
   if ((mutt_strcasecmp(mx1, "INBOX") == 0) && (mutt_strcasecmp(mx2, "INBOX") == 0))
     return 0;
 
-  b1 = safe_malloc(strlen(mx1) + 1);
-  b2 = safe_malloc(strlen(mx2) + 1);
+  b1 = mutt_mem_malloc(strlen(mx1) + 1);
+  b2 = mutt_mem_malloc(strlen(mx2) + 1);
 
   imap_fix_path(NULL, mx1, b1, strlen(mx1) + 1);
   imap_fix_path(NULL, mx2, b2, strlen(mx2) + 1);
@@ -611,14 +611,14 @@ void imap_error(const char *where, const char *msg)
  */
 struct ImapData *imap_new_idata(void)
 {
-  struct ImapData *idata = safe_calloc(1, sizeof(struct ImapData));
+  struct ImapData *idata = mutt_mem_calloc(1, sizeof(struct ImapData));
 
   idata->cmdbuf = mutt_buffer_new();
   if (!idata->cmdbuf)
     FREE(&idata);
 
   idata->cmdslots = ImapPipelineDepth + 2;
-  idata->cmds = safe_calloc(idata->cmdslots, sizeof(*idata->cmds));
+  idata->cmds = mutt_mem_calloc(idata->cmdslots, sizeof(*idata->cmds));
   if (!idata->cmds)
   {
     mutt_buffer_free(&idata->cmdbuf);
diff --git a/init.c b/init.c
index 40eb855c671d9db34fa0a39f7542fa9e60bae9de..af81e83e22b17ccb3cb565b526abf82ea2362a97 100644 (file)
--- a/init.c
+++ b/init.c
@@ -100,7 +100,7 @@ static void myvar_set(const char *var, const char *val)
       break;
 
   if (!*cur)
-    *cur = safe_calloc(1, sizeof(struct MyVar));
+    *cur = mutt_mem_calloc(1, sizeof(struct MyVar));
 
   if (!(*cur)->name)
     (*cur)->name = safe_strdup(var);
@@ -167,7 +167,7 @@ static int parse_regex(int idx, struct Buffer *tmp, struct Buffer *err)
       }
     }
 
-    rx = safe_malloc(sizeof(regex_t));
+    rx = mutt_mem_malloc(sizeof(regex_t));
     e = REGCOMP(rx, p, flags);
     if (e != 0)
     {
@@ -302,7 +302,7 @@ static struct MbTable *parse_mbtable(const char *s)
   mbstate_t mbstate;
   char *d = NULL;
 
-  t = safe_calloc(1, sizeof(struct MbTable));
+  t = mutt_mem_calloc(1, sizeof(struct MbTable));
   slen = mutt_strlen(s);
   if (!slen)
     return t;
@@ -310,8 +310,8 @@ static struct MbTable *parse_mbtable(const char *s)
   t->orig_str = safe_strdup(s);
   /* This could be more space efficient.  However, being used on tiny
    * strings (ToChars and StatusChars), the overhead is not great. */
-  t->chars = safe_calloc(slen, sizeof(char *));
-  d = t->segmented_str = safe_calloc(slen * 2, sizeof(char));
+  t->chars = mutt_mem_calloc(slen, sizeof(char *));
+  d = t->segmented_str = mutt_mem_calloc(slen * 2, sizeof(char));
 
   memset(&mbstate, 0, sizeof(mbstate));
   while (slen && (k = mbrtowc(NULL, s, slen, &mbstate)))
@@ -647,7 +647,7 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, int flags)
       {
         expnlen = mutt_strlen(expn.data);
         tok->dsize = expnlen + mutt_strlen(tok->dptr) + 1;
-        ptr = safe_malloc(tok->dsize);
+        ptr = mutt_mem_malloc(tok->dsize);
         memcpy(ptr, expn.data, expnlen);
         strcpy(ptr + expnlen, tok->dptr);
         if (tok->destroy)
@@ -767,7 +767,7 @@ static void add_to_stailq(struct ListHead *head, const char *str)
 
 static struct RegexList *new_regex_list(void)
 {
-  return safe_calloc(1, sizeof(struct RegexList));
+  return mutt_mem_calloc(1, sizeof(struct RegexList));
 }
 
 int mutt_add_to_regex_list(struct RegexList **list, const char *s, int flags,
@@ -856,7 +856,7 @@ static int remove_from_replace_list(struct ReplaceList **list, const char *pat)
 
 static struct ReplaceList *new_replace_list(void)
 {
-  return safe_calloc(1, sizeof(struct ReplaceList));
+  return mutt_mem_calloc(1, sizeof(struct ReplaceList));
 }
 
 static int add_to_replace_list(struct ReplaceList **list, const char *pat,
@@ -1555,7 +1555,7 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s,
     if (!buf->data || *buf->data == '\0')
       continue;
 
-    a = safe_malloc(sizeof(struct AttachMatch));
+    a = mutt_mem_malloc(sizeof(struct AttachMatch));
 
     /* some cheap hacks that I expect to remove */
     if (mutt_strcasecmp(buf->data, "any") == 0)
@@ -1577,7 +1577,7 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s,
     }
 
     len = strlen(a->minor);
-    tmpminor = safe_malloc(len + 3);
+    tmpminor = mutt_mem_malloc(len + 3);
     strcpy(&tmpminor[1], a->minor);
     tmpminor[0] = '^';
     tmpminor[len + 1] = '$';
@@ -1915,7 +1915,7 @@ static int parse_alias(struct Buffer *buf, struct Buffer *s, unsigned long data,
   if (!tmp)
   {
     /* create a new alias */
-    tmp = safe_calloc(1, sizeof(struct Alias));
+    tmp = mutt_mem_calloc(1, sizeof(struct Alias));
     tmp->name = safe_strdup(buf->data);
     /* give the main addressbook code a chance */
     if (CurrentMenu == MENU_ALIAS)
@@ -2148,7 +2148,7 @@ static void restore_default(struct Option *p)
         int retval;
         char *s = (char *) p->init;
 
-        pp->regex = safe_calloc(1, sizeof(regex_t));
+        pp->regex = mutt_mem_calloc(1, sizeof(regex_t));
         pp->pattern = safe_strdup((char *) p->init);
         if (mutt_strcmp(p->option, "mask") != 0)
           flags |= mutt_which_case((const char *) p->init);
@@ -2398,7 +2398,7 @@ void mutt_envlist_set(const char *name, const char *value, bool overwrite)
   /* If not found, add new slot */
   else
   {
-    safe_realloc(&envlist, sizeof(char *) * (count + 2));
+    mutt_mem_realloc(&envlist, sizeof(char *) * (count + 2));
     envlist[count] = safe_strdup(work);
     envlist[count + 1] = NULL;
   }
@@ -2472,7 +2472,7 @@ static int parse_setenv(struct Buffer *tmp, struct Buffer *s,
           count++;
         }
         *save = NULL;
-        safe_realloc(&envlist, sizeof(char *) * (count + 1));
+        mutt_mem_realloc(&envlist, sizeof(char *) * (count + 1));
         return 0;
       }
       envp++;
@@ -3361,7 +3361,7 @@ static void matches_ensure_morespace(int current)
     extra_space = Matches_listsize - base_space;
     extra_space *= 2;
     space = base_space + extra_space;
-    safe_realloc(&Matches, space * sizeof(char *));
+    mutt_mem_realloc(&Matches, space * sizeof(char *));
     memset(&Matches[current + 1], 0, space - current);
     Matches_listsize = space;
   }
@@ -3647,7 +3647,7 @@ static int complete_all_nm_tags(const char *pt)
     FREE(&nm_tags);
   }
   /* Allocate a new list, with sentinel. */
-  nm_tags = safe_malloc((tag_count_1 + 1) * sizeof(char *));
+  nm_tags = mutt_mem_malloc((tag_count_1 + 1) * sizeof(char *));
   nm_tags[tag_count_1] = NULL;
 
   /* Get all the tags. */
@@ -3882,7 +3882,7 @@ int mutt_query_variables(struct ListHead *queries)
   mutt_buffer_init(&token);
 
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
 
   struct ListNode *np;
   STAILQ_FOREACH(np, queries, entries)
@@ -3918,7 +3918,7 @@ int mutt_dump_variables(int hide_sensitive)
   mutt_buffer_init(&token);
 
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
 
   for (int i = 0; MuttVars[i].option; i++)
   {
@@ -3954,7 +3954,7 @@ static int execute_commands(struct ListHead *p)
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   mutt_buffer_init(&token);
   struct ListNode *np;
   STAILQ_FOREACH(np, p, entries)
@@ -4018,7 +4018,7 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   err.dptr = err.data;
 
   Groups = mutt_hash_create(1031, 0);
@@ -4112,12 +4112,12 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
 /* now get FQDN.  Use configured domain first, DNS next, then uname */
 #ifdef DOMAIN
   /* we have a compile-time domain name, use that for Hostname */
-  Hostname = safe_malloc(mutt_strlen(DOMAIN) + mutt_strlen(ShortHostname) + 2);
+  Hostname = mutt_mem_malloc(mutt_strlen(DOMAIN) + mutt_strlen(ShortHostname) + 2);
   sprintf(Hostname, "%s.%s", NONULL(ShortHostname), DOMAIN);
 #else
   if (!(getdnsdomainname(buffer, sizeof(buffer))))
   {
-    Hostname = safe_malloc(mutt_strlen(buffer) + mutt_strlen(ShortHostname) + 2);
+    Hostname = mutt_mem_malloc(mutt_strlen(buffer) + mutt_strlen(ShortHostname) + 2);
     sprintf(Hostname, "%s.%s", NONULL(ShortHostname), buffer);
   }
   else
@@ -4205,7 +4205,7 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
   mutt_set_langinfo_charset();
   mutt_set_charset(Charset);
 
-  Matches = safe_calloc(Matches_listsize, sizeof(char *));
+  Matches = mutt_mem_calloc(Matches_listsize, sizeof(char *));
 
   /* Set standard defaults */
   for (int i = 0; MuttVars[i].option; i++)
index ebc9ea3d2ef0abc1239ecf069de8f3ee614047f0..730d3f625157de97bed534a0e2cf4e78df51f961 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -134,9 +134,9 @@ static struct Keymap *alloc_keys(int len, keycode_t *keys)
 {
   struct Keymap *p = NULL;
 
-  p = safe_calloc(1, sizeof(struct Keymap));
+  p = mutt_mem_calloc(1, sizeof(struct Keymap));
   p->len = len;
-  p->keys = safe_malloc(len * sizeof(keycode_t));
+  p->keys = mutt_mem_malloc(len * sizeof(keycode_t));
   memcpy(p->keys, keys, len * sizeof(keycode_t));
   return p;
 }
diff --git a/main.c b/main.c
index 2104497647e1a643514ed4c3db0d958e0cff6239..75f29027fc619f034de908ddecc9b64f4c9716d8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -248,7 +248,7 @@ int main(int argc, char **argv, char **env)
     int count = 0;
     for (srcp = env; srcp && *srcp; srcp++)
       count++;
-    envlist = safe_calloc(count + 1, sizeof(char *));
+    envlist = mutt_mem_calloc(count + 1, sizeof(char *));
     for (srcp = env, dstp = envlist; srcp && *srcp; srcp++, dstp++)
       *dstp = safe_strdup(*srcp);
   }
diff --git a/mbox.c b/mbox.c
index 17c3830cc73e399fc8809606f61f21f2ed2f486a..60cc273f6f07f09247e14f383692139ecd0dbabb 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -1111,8 +1111,8 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint)
     offset -= (sizeof(MMDF_SEP) - 1);
 
   /* allocate space for the new offsets */
-  newOffset = safe_calloc(ctx->msgcount - first, sizeof(struct MUpdate));
-  oldOffset = safe_calloc(ctx->msgcount - first, sizeof(struct MUpdate));
+  newOffset = mutt_mem_calloc(ctx->msgcount - first, sizeof(struct MUpdate));
+  oldOffset = mutt_mem_calloc(ctx->msgcount - first, sizeof(struct MUpdate));
 
   if (!ctx->quiet)
   {
diff --git a/mbyte.c b/mbyte.c
index 391c01737f5e0d874907219d98bcf869461f40dc..c02620ed3b13cff80cb6bc2ce6a18e5ca9a1e425 100644 (file)
--- a/mbyte.c
+++ b/mbyte.c
@@ -106,7 +106,7 @@ int mutt_filter_unprintable(char **s)
     mutt_buffer_addstr(b, scratch);
   }
   FREE(s);
-  *s = b->data ? b->data : safe_calloc(1, 1);
+  *s = b->data ? b->data : mutt_mem_calloc(1, 1);
   FREE(&b);
   return 0;
 }
diff --git a/menu.c b/menu.c
index 8797eb9e99cb76bdf383443234f4c9e4b5e3e6c7..45bc0316f35bf543851031daf9d5faac036226df 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -800,7 +800,7 @@ void mutt_menu_init(void)
 
 struct Menu *mutt_new_menu(int menu)
 {
-  struct Menu *p = safe_calloc(1, sizeof(struct Menu));
+  struct Menu *p = mutt_mem_calloc(1, sizeof(struct Menu));
 
   if ((menu < 0) || (menu >= MENU_MAX))
     menu = MENU_GENERIC;
@@ -844,7 +844,7 @@ void mutt_push_current_menu(struct Menu *menu)
   if (MenuStackCount >= MenuStackLen)
   {
     MenuStackLen += 5;
-    safe_realloc(&MenuStack, MenuStackLen * sizeof(struct Menu *));
+    mutt_mem_realloc(&MenuStack, MenuStackLen * sizeof(struct Menu *));
   }
 
   MenuStack[MenuStackCount++] = menu;
diff --git a/mh.c b/mh.c
index 4f3d29f80473127869545c994ed86954d3cdeaf6..3285159bd771ebad09ce18515749edda36d39cca 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -118,7 +118,7 @@ static void mhs_alloc(struct MhSequences *mhs, int i)
   {
     newmax = i + 128;
     j = mhs->flags ? mhs->max + 1 : 0;
-    safe_realloc(&mhs->flags, sizeof(mhs->flags[0]) * (newmax + 1));
+    mutt_mem_realloc(&mhs->flags, sizeof(mhs->flags[0]) * (newmax + 1));
     while (j <= newmax)
       mhs->flags[j++] = 0;
 
@@ -884,7 +884,7 @@ static int maildir_parse_dir(struct Context *ctx, struct Maildir ***last,
     else
       h->path = safe_strdup(de->d_name);
 
-    entry = safe_calloc(1, sizeof(struct Maildir));
+    entry = mutt_mem_calloc(1, sizeof(struct Maildir));
     entry->h = h;
     entry->inode = de->d_ino;
     **last = entry;
@@ -1272,7 +1272,7 @@ static int mh_read_dir(struct Context *ctx, const char *subdir)
 
   if (!ctx->data)
   {
-    ctx->data = safe_calloc(1, sizeof(struct MhData));
+    ctx->data = mutt_mem_calloc(1, sizeof(struct MhData));
   }
   data = mh_data(ctx);
 
index 46f762427efe8ac0dc1040c0412f7ca732451017..f1c72499661b5dd79b581a257402ba0aa2f8dd69 100644 (file)
@@ -57,7 +57,7 @@ struct Buffer *mutt_buffer_new(void)
 {
   struct Buffer *b = NULL;
 
-  b = safe_malloc(sizeof(struct Buffer));
+  b = mutt_mem_malloc(sizeof(struct Buffer));
 
   mutt_buffer_init(b);
 
@@ -128,7 +128,7 @@ static void mutt_buffer_add(struct Buffer *buf, const char *s, size_t len)
   {
     size_t offset = buf->dptr - buf->data;
     buf->dsize += (len < 128) ? 128 : len + 1;
-    safe_realloc(&buf->data, buf->dsize);
+    mutt_mem_realloc(&buf->data, buf->dsize);
     buf->dptr = buf->data + offset;
   }
   if (!buf->dptr)
@@ -180,7 +180,7 @@ int mutt_buffer_printf(struct Buffer *buf, const char *fmt, ...)
   {
     blen = 128;
     buf->dsize += blen;
-    safe_realloc(&buf->data, buf->dsize);
+    mutt_mem_realloc(&buf->data, buf->dsize);
     buf->dptr = buf->data + doff;
   }
   len = vsnprintf(buf->dptr, blen, fmt, ap);
@@ -190,7 +190,7 @@ int mutt_buffer_printf(struct Buffer *buf, const char *fmt, ...)
     if (blen < 128)
       blen = 128;
     buf->dsize += blen;
-    safe_realloc(&buf->data, buf->dsize);
+    mutt_mem_realloc(&buf->data, buf->dsize);
     buf->dptr = buf->data + doff;
     len = vsnprintf(buf->dptr, len, fmt, ap_retry);
   }
index 2f0ffac9930eb7118363382743ee8c733718caee..46c8e69276582c9d061f6b4b290f729c95e4225b 100644 (file)
@@ -643,7 +643,7 @@ char *mutt_file_read_line(char *s, size_t *size, FILE *fp, int *line, int flags)
 
   if (!s)
   {
-    s = safe_malloc(STRING);
+    s = mutt_mem_malloc(STRING);
     *size = STRING;
   }
 
@@ -689,7 +689,7 @@ char *mutt_file_read_line(char *s, size_t *size, FILE *fp, int *line, int flags)
         /* There wasn't room for the line -- increase ``s'' */
         offset = *size - 1; /* overwrite the terminating 0 */
         *size += STRING;
-        safe_realloc(&s, *size);
+        mutt_mem_realloc(&s, *size);
       }
     }
   }
index 9998233d98801e317d71efe5b5170ab1c8a5a0c4..81a3a38cfc0b5f9e0114ce8a512ae119b0ddebc2 100644 (file)
@@ -150,11 +150,11 @@ static int cmp_int_key(union HashKey a, union HashKey b)
  */
 static struct Hash *new_hash(int nelem)
 {
-  struct Hash *table = safe_calloc(1, sizeof(struct Hash));
+  struct Hash *table = mutt_mem_calloc(1, sizeof(struct Hash));
   if (nelem == 0)
     nelem = 2;
   table->nelem = nelem;
-  table->table = safe_calloc(nelem, sizeof(struct HashElem *));
+  table->table = mutt_mem_calloc(nelem, sizeof(struct HashElem *));
   return table;
 }
 
@@ -171,7 +171,7 @@ static int union_hash_insert(struct Hash *table, union HashKey key, void *data)
   struct HashElem *ptr = NULL;
   unsigned int h;
 
-  ptr = safe_malloc(sizeof(struct HashElem));
+  ptr = mutt_mem_malloc(sizeof(struct HashElem));
   h = table->gen_hash(key, table->nelem);
   ptr->key = key;
   ptr->data = data;
index 5885c7b22eef739cee60fc9a77eb869f2612a311..34377d856842a98815ab3e26c090c80dc87ac9ba 100644 (file)
@@ -51,7 +51,7 @@
  */
 struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s)
 {
-  struct ListNode *np = safe_calloc(1, sizeof(struct ListNode));
+  struct ListNode *np = mutt_mem_calloc(1, sizeof(struct ListNode));
   np->data = s;
   STAILQ_INSERT_HEAD(h, np, entries);
   return np;
@@ -65,7 +65,7 @@ struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s)
  */
 struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s)
 {
-  struct ListNode *np = safe_calloc(1, sizeof(struct ListNode));
+  struct ListNode *np = mutt_mem_calloc(1, sizeof(struct ListNode));
   np->data = s;
   STAILQ_INSERT_TAIL(h, np, entries);
   return np;
@@ -80,7 +80,7 @@ struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s)
  */
 struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s)
 {
-  struct ListNode *np = safe_calloc(1, sizeof(struct ListNode));
+  struct ListNode *np = mutt_mem_calloc(1, sizeof(struct ListNode));
   np->data = s;
   STAILQ_INSERT_AFTER(h, n, np, entries);
   return np;
index 66ed7d8aa5605c4f80651fdf92846df09545d8c1..42b46d5df25b97a7740aba7c8e3c4ac3beb0167b 100644 (file)
@@ -316,7 +316,7 @@ size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf)
       if (i >= wbuflen)
       {
         wbuflen = i + 20;
-        safe_realloc(&wbuf, wbuflen * sizeof(*wbuf));
+        mutt_mem_realloc(&wbuf, wbuflen * sizeof(*wbuf));
       }
       wbuf[i++] = wc;
     }
@@ -325,7 +325,7 @@ size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf)
       if (i >= wbuflen)
       {
         wbuflen = i + 20;
-        safe_realloc(&wbuf, wbuflen * sizeof(*wbuf));
+        mutt_mem_realloc(&wbuf, wbuflen * sizeof(*wbuf));
       }
       wbuf[i++] = ReplacementChar;
       buf++;
index 6e98e59f240da7d6aa137c261d67deaa8a1f953e..08f641916d114b1f4b1504f95559b4c1afe6e88f 100644 (file)
  * @note If any of the allocators fail, the user is notified and the program is
  *       stopped immediately.
  *
- * | Function       | Description
- * | :------------- | :-----------------------------------
- * | safe_calloc()  | Allocate zeroed memory on the heap
- * | safe_free()    | Release memory allocated on the heap
- * | safe_malloc()  | Allocate memory on the heap
- * | safe_realloc() | Resize a block of memory on the heap
+ * | Function           | Description
+ * | :----------------- | :-----------------------------------
+ * | mutt_mem_calloc()  | Allocate zeroed memory on the heap
+ * | mutt_mem_free()    | Release memory allocated on the heap
+ * | mutt_mem_malloc()  | Allocate memory on the heap
+ * | mutt_mem_realloc() | Resize a block of memory on the heap
  */
 
 #include "config.h"
@@ -45,7 +45,7 @@
 #include "message.h"
 
 /**
- * safe_calloc - Allocate zeroed memory on the heap
+ * mutt_mem_calloc - Allocate zeroed memory on the heap
  * @param nmemb Number of blocks
  * @param size  Size of blocks
  * @retval ptr Memory on the heap
@@ -53,9 +53,9 @@
  * @note This function will never return NULL.
  *       It will print and error and exit the program.
  *
- * The caller should call safe_free() to release the memory
+ * The caller should call mutt_mem_free() to release the memory
  */
-void *safe_calloc(size_t nmemb, size_t size)
+void *mutt_mem_calloc(size_t nmemb, size_t size)
 {
   void *p = NULL;
 
@@ -80,10 +80,10 @@ void *safe_calloc(size_t nmemb, size_t size)
 }
 
 /**
- * safe_free - Release memory allocated on the heap
+ * mutt_mem_free - Release memory allocated on the heap
  * @param ptr Memory to release
  */
-void safe_free(void *ptr)
+void mutt_mem_free(void *ptr)
 {
   if (!ptr)
     return;
@@ -96,16 +96,16 @@ void safe_free(void *ptr)
 }
 
 /**
- * safe_malloc - Allocate memory on the heap
+ * mutt_mem_malloc - Allocate memory on the heap
  * @param size Size of block to allocate
  * @retval ptr Memory on the heap
  *
  * @note This function will never return NULL.
  *       It will print and error and exit the program.
  *
- * The caller should call safe_free() to release the memory
+ * The caller should call mutt_mem_free() to release the memory
  */
-void *safe_malloc(size_t size)
+void *mutt_mem_malloc(size_t size)
 {
   void *p = NULL;
 
@@ -122,7 +122,7 @@ void *safe_malloc(size_t size)
 }
 
 /**
- * safe_realloc - Resize a block of memory on the heap
+ * mutt_mem_realloc - Resize a block of memory on the heap
  * @param ptr Memory block to resize
  * @param size New size
  *
@@ -131,7 +131,7 @@ void *safe_malloc(size_t size)
  *
  * If the new size is zero, the block will be freed.
  */
-void safe_realloc(void *ptr, size_t size)
+void mutt_mem_realloc(void *ptr, size_t size)
 {
   void *r = NULL;
   void **p = (void **) ptr;
index 52b461c15fbc9c95c1312b9ba06df9a8a2b77152..ffd74a735c8fef69a763844c6dcafe6aa3876ef4 100644 (file)
 
 #define mutt_array_size(x) (sizeof(x) / sizeof((x)[0]))
 
-void *safe_calloc(size_t nmemb, size_t size);
-void  safe_free(void *ptr);
-void *safe_malloc(size_t size);
-void  safe_realloc(void *ptr, size_t size);
+void *mutt_mem_calloc(size_t nmemb, size_t size);
+void  mutt_mem_free(void *ptr);
+void *mutt_mem_malloc(size_t size);
+void  mutt_mem_realloc(void *ptr, size_t size);
 
-#define FREE(x) safe_free(x)
+#define FREE(x) mutt_mem_free(x)
 
 #endif /* _MUTT_MEMORY_H */
index 0f2694ebe068231b179e55877d4a42444c58dfb2..e4ea87f3721c35fa86eda9a5a0440e75ce6197b3 100644 (file)
@@ -178,7 +178,7 @@ char *safe_strdup(const char *s)
   if (!s || !*s)
     return 0;
   l = strlen(s) + 1;
-  p = safe_malloc(l);
+  p = mutt_mem_malloc(l);
   memcpy(p, s, l);
   return p;
 }
@@ -271,7 +271,7 @@ void mutt_str_append_item(char **str, const char *item, int sep)
   size_t sz = strlen(item);
   size_t ssz = *str ? strlen(*str) : 0;
 
-  safe_realloc(str, ssz + ((ssz && sep) ? 1 : 0) + sz + 1);
+  mutt_mem_realloc(str, ssz + ((ssz && sep) ? 1 : 0) + sz + 1);
   p = *str + ssz;
   if (sep && ssz)
     *p++ = sep;
@@ -291,7 +291,7 @@ void mutt_str_adjust(char **p)
 {
   if (!p || !*p)
     return;
-  safe_realloc(p, strlen(*p) + 1);
+  mutt_mem_realloc(p, strlen(*p) + 1);
 }
 
 /**
@@ -386,7 +386,7 @@ char *mutt_substrdup(const char *begin, const char *end)
     len = strlen(begin);
   }
 
-  p = safe_malloc(len + 1);
+  p = mutt_mem_malloc(len + 1);
   memcpy(p, begin, len);
   p[len] = '\0';
   return p;
index b5673f593d225913ba196019c19011e3b2d2e3ba..689af423262b2472df07e973d58fdf2519dd6880 100644 (file)
@@ -186,7 +186,7 @@ static char *intl_to_local(char *orig_user, char *orig_domain, int flags)
     }
   }
 
-  mailbox = safe_malloc(mutt_strlen(local_user) + mutt_strlen(local_domain) + 2);
+  mailbox = mutt_mem_malloc(mutt_strlen(local_user) + mutt_strlen(local_domain) + 2);
   sprintf(mailbox, "%s@%s", NONULL(local_user), NONULL(local_domain));
 
 cleanup:
@@ -224,7 +224,7 @@ static char *local_to_intl(char *user, char *domain)
   }
 #endif /* HAVE_LIBIDN */
 
-  mailbox = safe_malloc(mutt_strlen(intl_user) + mutt_strlen(intl_domain) + 2);
+  mailbox = mutt_mem_malloc(mutt_strlen(intl_user) + mutt_strlen(intl_domain) + 2);
   sprintf(mailbox, "%s@%s", NONULL(intl_user), NONULL(intl_domain));
 
 cleanup:
index 8b2cd84f5e87ca42710e8c4387d150e3a622bbf1..cf912131cb4b15013312d1368aa6cdbfc870f7a3 100644 (file)
@@ -70,7 +70,7 @@ static int lua_mutt_call(lua_State *l)
   mutt_buffer_init(&err);
 
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
 
   if (lua_gettop(l) == 0)
   {
@@ -274,7 +274,7 @@ static int lua_mutt_enter(lua_State *l)
   mutt_buffer_init(&token);
 
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
 
   if (mutt_parse_rc_line(buffer, &token, &err))
   {
index 07f4ba67327aaec684f5f3826ba6ead719aed65a..a99f444626f9c85abc5da6113cafb6d47fd69b3a 100644 (file)
@@ -232,7 +232,7 @@ static struct NmCtxData *new_ctxdata(const char *uri)
   if (!uri)
     return NULL;
 
-  data = safe_calloc(1, sizeof(struct NmCtxData));
+  data = mutt_mem_calloc(1, sizeof(struct NmCtxData));
   mutt_debug(1, "nm: initialize context data %p\n", (void *) data);
 
   data->db_limit = NmDbLimit;
@@ -846,7 +846,7 @@ static char *nm2mutt_message_id(const char *id)
   if (!id)
     return NULL;
   sz = strlen(id) + 3;
-  mid = safe_malloc(sz);
+  mid = mutt_mem_malloc(sz);
 
   snprintf(mid, sz, "<%s>", id);
   return mid;
@@ -861,7 +861,7 @@ static int init_header(struct Header *h, const char *path, notmuch_message_t *ms
 
   id = notmuch_message_get_message_id(msg);
 
-  h->data = safe_calloc(1, sizeof(struct NmHdrData));
+  h->data = mutt_mem_calloc(1, sizeof(struct NmHdrData));
   h->free_cb = deinit_header;
 
   /*
index 28f8bd924786e6be3473a6d0f6662e170f692e3e..1c1996419718108284883a5c4254ae646546843e 100644 (file)
@@ -146,7 +146,7 @@ static void driver_tags_add(struct TagHead *head, char *new_tag)
 {
   char *new_tag_transformed = mutt_hash_find(TagTransforms, new_tag);
 
-  struct TagNode *np = safe_calloc(1, sizeof(struct TagNode));
+  struct TagNode *np = mutt_mem_calloc(1, sizeof(struct TagNode));
   np->name = safe_strdup(new_tag);
   np->hidden = false;
   if (new_tag_transformed)
index e40198c5e63f743540c0a3a537c60602d4afeaba..99f0984dd54f3e154f0f1a6f213806dbd491acf7 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -815,7 +815,7 @@ char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList
     /* If this pattern needs more matches, expand pmatch. */
     if (l->nmatch > nmatch)
     {
-      safe_realloc(&pmatch, l->nmatch * sizeof(regmatch_t));
+      mutt_mem_realloc(&pmatch, l->nmatch * sizeof(regmatch_t));
       nmatch = l->nmatch;
     }
 
@@ -1544,9 +1544,9 @@ const char *mutt_make_version(void)
 
 struct Regex *mutt_compile_regex(const char *s, int flags)
 {
-  struct Regex *pp = safe_calloc(1, sizeof(struct Regex));
+  struct Regex *pp = mutt_mem_calloc(1, sizeof(struct Regex));
   pp->pattern = safe_strdup(s);
-  pp->regex = safe_calloc(1, sizeof(regex_t));
+  pp->regex = mutt_mem_calloc(1, sizeof(regex_t));
   if (REGCOMP(pp->regex, NONULL(s), flags) != 0)
     mutt_free_regex(&pp);
 
@@ -1638,7 +1638,7 @@ bool mutt_match_spam_list(const char *s, struct ReplaceList *l, char *text, int
     /* If this pattern needs more matches, expand pmatch. */
     if (l->nmatch > nmatch)
     {
-      safe_realloc(&pmatch, l->nmatch * sizeof(regmatch_t));
+      mutt_mem_realloc(&pmatch, l->nmatch * sizeof(regmatch_t));
       nmatch = l->nmatch;
     }
 
diff --git a/mx.c b/mx.c
index 4dfbcbf0c8e0ce65ef07b2afb597901fbcde3ca8..1783d45c33521f3927eb71c7bd2440d6c5a87448 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -414,7 +414,7 @@ struct Context *mx_open_mailbox(const char *path, int flags, struct Context *pct
     return NULL;
 
   if (!ctx)
-    ctx = safe_malloc(sizeof(struct Context));
+    ctx = mutt_mem_malloc(sizeof(struct Context));
   memset(ctx, 0, sizeof(struct Context));
 
   ctx->path = safe_strdup(path);
@@ -1135,7 +1135,7 @@ struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, in
     return NULL;
   }
 
-  msg = safe_calloc(1, sizeof(struct Message));
+  msg = mutt_mem_calloc(1, sizeof(struct Message));
   msg->write = true;
 
   if (hdr)
@@ -1205,7 +1205,7 @@ struct Message *mx_open_message(struct Context *ctx, int msgno)
     return NULL;
   }
 
-  msg = safe_calloc(1, sizeof(struct Message));
+  msg = mutt_mem_calloc(1, sizeof(struct Message));
   if (ctx->mx_ops->open_msg(ctx, msg, msgno))
     FREE(&msg);
 
@@ -1267,13 +1267,13 @@ void mx_alloc_memory(struct Context *ctx)
 
   if (ctx->hdrs)
   {
-    safe_realloc(&ctx->hdrs, sizeof(struct Header *) * (ctx->hdrmax += 25));
-    safe_realloc(&ctx->v2r, sizeof(int) * ctx->hdrmax);
+    mutt_mem_realloc(&ctx->hdrs, sizeof(struct Header *) * (ctx->hdrmax += 25));
+    mutt_mem_realloc(&ctx->v2r, sizeof(int) * ctx->hdrmax);
   }
   else
   {
-    ctx->hdrs = safe_calloc((ctx->hdrmax += 25), sizeof(struct Header *));
-    ctx->v2r = safe_calloc(ctx->hdrmax, sizeof(int));
+    ctx->hdrs = mutt_mem_calloc((ctx->hdrmax += 25), sizeof(struct Header *));
+    ctx->v2r = mutt_mem_calloc(ctx->hdrmax, sizeof(int));
   }
   for (int i = ctx->msgcount; i < ctx->hdrmax; i++)
   {
index 5f115ac7dcbe3b24434462d075fde063128860a4..bca944a5d665393850f268ff56d012414c8e341c 100644 (file)
@@ -870,7 +870,7 @@ int crypt_get_keys(struct Header *msg, char **keylist, int oppenc_mode)
   if (!oppenc_mode && self_encrypt && *self_encrypt)
   {
     keylist_size = mutt_strlen(*keylist);
-    safe_realloc(keylist, keylist_size + mutt_strlen(self_encrypt) + 2);
+    mutt_mem_realloc(keylist, keylist_size + mutt_strlen(self_encrypt) + 2);
     sprintf(*keylist + keylist_size, " %s", self_encrypt);
   }
 
@@ -919,7 +919,7 @@ static void crypt_fetch_signatures(struct Body ***signatures, struct Body *a, in
     else
     {
       if ((*n % 5) == 0)
-        safe_realloc(signatures, (*n + 6) * sizeof(struct Body **));
+        mutt_mem_realloc(signatures, (*n + 6) * sizeof(struct Body **));
 
       (*signatures)[(*n)++] = a;
     }
index b864190832e15da170480ee86eb6cec30c28a78e..6c0cff50c74a9f24f23702906b1ec46028dfa43c 100644 (file)
@@ -174,7 +174,7 @@ static void print_utf8(FILE *fp, const char *buf, size_t len)
 {
   char *tstr = NULL;
 
-  tstr = safe_malloc(len + 1);
+  tstr = mutt_mem_malloc(len + 1);
   memcpy(tstr, buf, len);
   tstr[len] = 0;
 
@@ -333,7 +333,7 @@ static struct CryptKeyInfo *crypt_copy_key(struct CryptKeyInfo *key)
 {
   struct CryptKeyInfo *k = NULL;
 
-  k = safe_calloc(1, sizeof(*k));
+  k = mutt_mem_calloc(1, sizeof(*k));
   k->kobj = key->kobj;
   gpgme_key_ref(key->kobj);
   k->idx = key->idx;
@@ -766,7 +766,7 @@ static gpgme_key_t *create_recipient_set(const char *keylist, gpgme_protocol_t p
         else
           err = gpgme_get_key(context, buf, &key, 0);
 
-        safe_realloc(&rset, sizeof(*rset) * (rset_n + 1));
+        mutt_mem_realloc(&rset, sizeof(*rset) * (rset_n + 1));
         if (!err)
           rset[rset_n++] = key;
         else
@@ -782,7 +782,7 @@ static gpgme_key_t *create_recipient_set(const char *keylist, gpgme_protocol_t p
   }
 
   /* NULL terminate.  */
-  safe_realloc(&rset, sizeof(*rset) * (rset_n + 1));
+  mutt_mem_realloc(&rset, sizeof(*rset) * (rset_n + 1));
   rset[rset_n++] = NULL;
 
   if (context)
@@ -1379,7 +1379,7 @@ static void show_fingerprint(gpgme_key_t key, struct State *state)
     return;
   is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP);
 
-  buf = safe_malloc(strlen(prefix) + strlen(s) * 4 + 2);
+  buf = mutt_mem_malloc(strlen(prefix) + strlen(s) * 4 + 2);
   strcpy(buf, prefix);
   p = buf + strlen(buf);
   if (is_pgp && strlen(s) == 40)
@@ -3317,7 +3317,7 @@ static const char *parse_dn_part(struct DnArray *array, const char *string)
   n = s - string;
   if (!n)
     return NULL; /* empty key */
-  array->key = safe_malloc(n + 1);
+  array->key = mutt_mem_malloc(n + 1);
   p = array->key;
   memcpy(p, string, n); /* fixme: trim trailing spaces */
   p[n] = 0;
@@ -3332,7 +3332,7 @@ static const char *parse_dn_part(struct DnArray *array, const char *string)
     if (!n || (n & 1))
       return NULL; /* empty or odd number of digits */
     n /= 2;
-    p = safe_malloc(n + 1);
+    p = mutt_mem_malloc(n + 1);
     array->value = (char *) p;
     for (s1 = string; n; s1 += 2, n--)
       sscanf(s1, "%2hhx", (unsigned char *) p++);
@@ -3365,7 +3365,7 @@ static const char *parse_dn_part(struct DnArray *array, const char *string)
         n++;
     }
 
-    p = safe_malloc(n + 1);
+    p = mutt_mem_malloc(n + 1);
     array->value = (char *) p;
     for (s = string; n; s++, n--)
     {
@@ -3400,7 +3400,7 @@ static struct DnArray *parse_dn(const char *string)
   size_t arrayidx, arraysize;
 
   arraysize = 7; /* C,ST,L,O,OU,CN,email */
-  array = safe_malloc((arraysize + 1) * sizeof(*array));
+  array = mutt_mem_malloc((arraysize + 1) * sizeof(*array));
   arrayidx = 0;
   while (*string)
   {
@@ -3410,11 +3410,11 @@ static struct DnArray *parse_dn(const char *string)
       break; /* ready */
     if (arrayidx >= arraysize)
     {
-      /* neomutt lacks a real safe_realloc - so we need to copy */
+      /* neomutt lacks a real mutt_mem_realloc - so we need to copy */
       struct DnArray *a2 = NULL;
 
       arraysize += 5;
-      a2 = safe_malloc((arraysize + 1) * sizeof(*array));
+      a2 = mutt_mem_malloc((arraysize + 1) * sizeof(*array));
       for (int i = 0; i < arrayidx; i++)
       {
         a2[i].key = array[i].key;
@@ -3913,7 +3913,7 @@ static char *list_to_pattern(struct ListHead *list)
     n++; /* delimiter or end of string */
   }
   n++; /* make sure to allocate at least one byte */
-  pattern = p = safe_calloc(1, n);
+  pattern = p = mutt_mem_calloc(1, n);
   STAILQ_FOREACH(np, list, entries)
   {
     s = np->data;
@@ -3992,7 +3992,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, unsigned int
     if (!n)
       goto no_pgphints;
 
-    char **patarr = safe_calloc(n + 1, sizeof(*patarr));
+    char **patarr = mutt_mem_calloc(n + 1, sizeof(*patarr));
     n = 0;
     STAILQ_FOREACH(np, hints, entries)
     {
@@ -4030,7 +4030,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, unsigned int
 
       for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next)
       {
-        k = safe_calloc(1, sizeof(*k));
+        k = mutt_mem_calloc(1, sizeof(*k));
         k->kobj = key;
         gpgme_key_ref(k->kobj);
         k->idx = idx;
@@ -4074,7 +4074,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, unsigned int
 
       for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next)
       {
-        k = safe_calloc(1, sizeof(*k));
+        k = mutt_mem_calloc(1, sizeof(*k));
         k->kobj = key;
         gpgme_key_ref(k->kobj);
         k->idx = idx;
@@ -4156,7 +4156,7 @@ static struct CryptKeyInfo *crypt_select_key(struct CryptKeyInfo *keys,
     if (i == keymax)
     {
       keymax += 20;
-      safe_realloc(&key_table, sizeof(struct CryptKeyInfo *) * keymax);
+      mutt_mem_realloc(&key_table, sizeof(struct CryptKeyInfo *) * keymax);
     }
 
     key_table[i++] = k;
@@ -4560,7 +4560,7 @@ static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short ab
         mutt_str_replace(&l->dflt, resp);
       else
       {
-        l = safe_malloc(sizeof(struct CryptCache));
+        l = mutt_mem_malloc(sizeof(struct CryptCache));
         l->next = id_defaults;
         id_defaults = l;
         l->what = safe_strdup(whatfor);
@@ -4687,7 +4687,7 @@ static char *find_keys(struct Address *adrlist, unsigned int app, int oppenc_mod
 
     bypass_selection:
       keylist_size += mutt_strlen(keyID) + 4 + 1;
-      safe_realloc(&keylist, keylist_size);
+      mutt_mem_realloc(&keylist, keylist_size);
       sprintf(keylist + keylist_used, "%s0x%s%s", keylist_used ? " " : "",
               keyID, forced_valid ? "!" : "");
       keylist_used = mutt_strlen(keylist);
index 940ab4b1cc1539164749fa7c2be1b63214615355..04fd38b91f00d01c9ce1fecc4c193930361b05d7 100644 (file)
@@ -43,7 +43,7 @@ modules = STAILQ_HEAD_INITIALIZER(modules);
  */
 void crypto_module_register(struct CryptModuleSpecs *specs)
 {
-  struct CryptModule *module = safe_calloc(1, sizeof(struct CryptModule));
+  struct CryptModule *module = mutt_mem_calloc(1, sizeof(struct CryptModule));
   module->specs = specs;
   STAILQ_INSERT_HEAD(&modules, module, entries);
 }
index 14e00c8d30611d2936417605e744c91093639704..6ea64c4ee13e18233d7b0c92ff6085fdc3a18403 100644 (file)
@@ -98,7 +98,7 @@ static void fix_uid(char *uid)
     char *ob = NULL;
     size_t ibl, obl;
 
-    buf = safe_malloc(n + 1);
+    buf = mutt_mem_malloc(n + 1);
     ib = uid;
     ibl = d - uid + 1;
     ob = buf;
@@ -312,7 +312,7 @@ static struct PgpKeyInfo *parse_pub_line(char *buf, int *is_subkey, struct PgpKe
 
         mutt_debug(2, "user ID: %s\n", NONULL(p));
 
-        uid = safe_calloc(1, sizeof(struct PgpUid));
+        uid = mutt_mem_calloc(1, sizeof(struct PgpUid));
         fix_uid(p);
         uid->addr = safe_strdup(p);
         uid->trust = trust;
@@ -364,7 +364,7 @@ static struct PgpKeyInfo *parse_pub_line(char *buf, int *is_subkey, struct PgpKe
 
   /* merge temp key back into real key */
   if (!(is_uid || is_fpr || (*is_subkey && option(OPT_PGP_IGNORE_SUBKEYS))))
-    k = safe_malloc(sizeof(*k));
+    k = mutt_mem_malloc(sizeof(*k));
   memcpy(k, &tmp, sizeof(*k));
   /* fixup parentship of uids after merging the temp key into
    * the real key */
index 3592b0b17b1c5e8a6079968dad5b2f721131c06a..29b20322d2e61c5b64bebefd4055fbf1a83143ee 100644 (file)
@@ -1332,7 +1332,7 @@ char *pgp_find_keys(struct Address *adrlist, int oppenc_mode)
 
     bypass_selection:
       keylist_size += mutt_strlen(keyID) + 4;
-      safe_realloc(&keylist, keylist_size);
+      mutt_mem_realloc(&keylist, keylist_size);
       sprintf(keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", keyID);
       keylist_used = mutt_strlen(keylist);
 
index 144b54ee88a5d5442576678f0af0b5f234fb70b1..7d732b49d35bddb7346c7223a02518ffd36ceceb 100644 (file)
@@ -486,7 +486,7 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys,
       if (i == keymax)
       {
         keymax += 5;
-        safe_realloc(&KeyTable, sizeof(struct PgpUid *) * keymax);
+        mutt_mem_realloc(&KeyTable, sizeof(struct PgpUid *) * keymax);
       }
 
       KeyTable[i++] = a;
@@ -690,7 +690,7 @@ struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, en
         mutt_str_replace(&l->dflt, resp);
       else
       {
-        l = safe_malloc(sizeof(struct PgpCache));
+        l = mutt_mem_malloc(sizeof(struct PgpCache));
         l->next = id_defaults;
         id_defaults = l;
         l->what = safe_strdup(whatfor);
index a3b7e03b4d0274b3a3ea582461d9b19eb65ce407..fbe7a673b9d27387a6734da2f09b7251926bfaec 100644 (file)
@@ -128,7 +128,7 @@ struct PgpUid *pgp_copy_uids(struct PgpUid *up, struct PgpKeyInfo *parent)
 
   for (; up; up = up->next)
   {
-    *lp = safe_calloc(1, sizeof(struct PgpUid));
+    *lp = mutt_mem_calloc(1, sizeof(struct PgpUid));
     (*lp)->trust = up->trust;
     (*lp)->flags = up->flags;
     (*lp)->addr = safe_strdup(up->addr);
index 1d198b7224327e49d5f30f265b50748d1dad1183..c1c0274caa017158dfe2b8b1efe775e7ab1940ba 100644 (file)
@@ -86,7 +86,7 @@ struct PgpKeyInfo * pgp_remove_key(struct PgpKeyInfo * *klist, struct PgpKeyInfo
 
 static inline struct PgpKeyInfo *pgp_new_keyinfo(void)
 {
-  return safe_calloc(1, sizeof(struct PgpKeyInfo));
+  return mutt_mem_calloc(1, sizeof(struct PgpKeyInfo));
 }
 
 #endif /* CRYPT_BACKEND_CLASSIC_PGP */
index 110ffa23a6c953d8c49fc7a54ff5229fc78f2475..308b7c8d2a8073901b1d7d9739c76a72bc0a0646 100644 (file)
@@ -75,7 +75,7 @@ unsigned char *pgp_read_packet(FILE *fp, size_t *len)
   if (!plen)
   {
     plen = CHUNKSIZE;
-    pbuf = safe_malloc(plen);
+    pbuf = mutt_mem_malloc(plen);
   }
 
   if (fread(&ctb, 1, 1, fp) < 1)
index e7c749bee6d6b962ff30c5700af38de2e299958b..a886c893113ff2a051e893bb6e8849879b7be0ae 100644 (file)
@@ -106,7 +106,7 @@ static struct SmimeKey *smime_copy_key(struct SmimeKey *key)
   if (!key)
     return NULL;
 
-  copy = safe_calloc(1, sizeof(struct SmimeKey));
+  copy = mutt_mem_calloc(1, sizeof(struct SmimeKey));
   copy->email = safe_strdup(key->email);
   copy->hash = safe_strdup(key->hash);
   copy->label = safe_strdup(key->label);
@@ -402,7 +402,7 @@ static struct SmimeKey *smime_select_key(struct SmimeKey *keys, char *query)
     if (table_index == table_size)
     {
       table_size += 5;
-      safe_realloc(&table, sizeof(struct SmimeKey *) * table_size);
+      mutt_mem_realloc(&table, sizeof(struct SmimeKey *) * table_size);
     }
 
     table[table_index++] = key;
@@ -485,7 +485,7 @@ static struct SmimeKey *smime_parse_key(char *buf)
   char *pend = NULL, *p = NULL;
   int field = 0;
 
-  key = safe_calloc(1, sizeof(struct SmimeKey));
+  key = mutt_mem_calloc(1, sizeof(struct SmimeKey));
 
   for (p = buf; p; p = pend)
   {
@@ -889,7 +889,7 @@ char *smime_find_keys(struct Address *adrlist, int oppenc_mode)
 
     keyID = key->hash;
     keylist_size += mutt_strlen(keyID) + 2;
-    safe_realloc(&keylist, keylist_size);
+    mutt_mem_realloc(&keylist, keylist_size);
     sprintf(keylist + keylist_used, "%s%s", keylist_used ? " " : "", keyID);
     keylist_used = mutt_strlen(keylist);
 
@@ -971,7 +971,7 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, int copy,
   if (copy && buffer && num)
   {
     (*num) = count;
-    *buffer = safe_calloc(count, sizeof(char *));
+    *buffer = mutt_mem_calloc(count, sizeof(char *));
     count = 0;
 
     rewind(fpout);
@@ -980,7 +980,7 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, int copy,
       len = mutt_strlen(email);
       if (len && (email[len - 1] == '\n'))
         email[len - 1] = '\0';
-      (*buffer)[count] = safe_calloc(mutt_strlen(email) + 1, sizeof(char));
+      (*buffer)[count] = mutt_mem_calloc(mutt_strlen(email) + 1, sizeof(char));
       strncpy((*buffer)[count], email, mutt_strlen(email));
       count++;
     }
@@ -1456,7 +1456,7 @@ static char *openssl_md_to_smime_micalg(char *md)
   if (mutt_strncasecmp("sha", md, 3) == 0)
   {
     l = strlen(md) + 2;
-    micalg = safe_malloc(l);
+    micalg = mutt_mem_malloc(l);
     snprintf(micalg, l, "sha-%s", md + 3);
   }
   else
index 8193e4a2c4c56ff6220d2e0a778a2502cbf18965..c2c75d5b4719eea030332a8c83d3baf67803f992 100644 (file)
--- a/newsrc.c
+++ b/newsrc.c
@@ -66,7 +66,7 @@ static struct NntpData *nntp_data_find(struct NntpServer *nserv, const char *gro
   {
     int len = strlen(group) + 1;
     /* create NntpData structure and add it to hash */
-    nntp_data = safe_calloc(1, sizeof(struct NntpData) + len);
+    nntp_data = mutt_mem_calloc(1, sizeof(struct NntpData) + len);
     nntp_data->group = (char *) nntp_data + sizeof(struct NntpData);
     strfcpy(nntp_data->group, group, len);
     nntp_data->nserv = nserv;
@@ -77,7 +77,7 @@ static struct NntpData *nntp_data_find(struct NntpServer *nserv, const char *gro
     if (nserv->groups_num >= nserv->groups_max)
     {
       nserv->groups_max *= 2;
-      safe_realloc(&nserv->groups_list, nserv->groups_max * sizeof(nntp_data));
+      mutt_mem_realloc(&nserv->groups_list, nserv->groups_max * sizeof(nntp_data));
     }
     nserv->groups_list[nserv->groups_num++] = nntp_data;
   }
@@ -223,7 +223,7 @@ int nntp_newsrc_parse(struct NntpServer *nserv)
     FREE(&nntp_data->newsrc_ent);
   }
 
-  line = safe_malloc(sb.st_size + 1);
+  line = mutt_mem_malloc(sb.st_size + 1);
   while (sb.st_size && fgets(line, sb.st_size + 1, nserv->newsrc_fp))
   {
     char *b = NULL, *h = NULL, *p = NULL;
@@ -250,7 +250,7 @@ int nntp_newsrc_parse(struct NntpServer *nserv)
     while (*b)
       if (*b++ == ',')
         j++;
-    nntp_data->newsrc_ent = safe_calloc(j, sizeof(struct NewsrcEntry));
+    nntp_data->newsrc_ent = mutt_mem_calloc(j, sizeof(struct NewsrcEntry));
     nntp_data->subscribed = subs;
 
     /* parse entries */
@@ -284,7 +284,7 @@ int nntp_newsrc_parse(struct NntpServer *nserv)
     if (nntp_data->last_message == 0)
       nntp_data->last_message = nntp_data->newsrc_ent[j - 1].last;
     nntp_data->newsrc_len = j;
-    safe_realloc(&nntp_data->newsrc_ent, j * sizeof(struct NewsrcEntry));
+    mutt_mem_realloc(&nntp_data->newsrc_ent, j * sizeof(struct NewsrcEntry));
     nntp_group_unread_stat(nntp_data);
     mutt_debug(2, "nntp_newsrc_parse: %s\n", nntp_data->group);
   }
@@ -314,7 +314,7 @@ void nntp_newsrc_gen_entries(struct Context *ctx)
   if (!entries)
   {
     entries = 5;
-    nntp_data->newsrc_ent = safe_calloc(entries, sizeof(struct NewsrcEntry));
+    nntp_data->newsrc_ent = mutt_mem_calloc(entries, sizeof(struct NewsrcEntry));
   }
 
   /* Set up to fake initial sequence from 1 to the article before the
@@ -335,7 +335,7 @@ void nntp_newsrc_gen_entries(struct Context *ctx)
         if (nntp_data->newsrc_len >= entries)
         {
           entries *= 2;
-          safe_realloc(&nntp_data->newsrc_ent, entries * sizeof(struct NewsrcEntry));
+          mutt_mem_realloc(&nntp_data->newsrc_ent, entries * sizeof(struct NewsrcEntry));
         }
         nntp_data->newsrc_ent[nntp_data->newsrc_len].first = first;
         nntp_data->newsrc_ent[nntp_data->newsrc_len].last = last - 1;
@@ -361,13 +361,13 @@ void nntp_newsrc_gen_entries(struct Context *ctx)
     if (nntp_data->newsrc_len >= entries)
     {
       entries++;
-      safe_realloc(&nntp_data->newsrc_ent, entries * sizeof(struct NewsrcEntry));
+      mutt_mem_realloc(&nntp_data->newsrc_ent, entries * sizeof(struct NewsrcEntry));
     }
     nntp_data->newsrc_ent[nntp_data->newsrc_len].first = first;
     nntp_data->newsrc_ent[nntp_data->newsrc_len].last = nntp_data->last_loaded;
     nntp_data->newsrc_len++;
   }
-  safe_realloc(&nntp_data->newsrc_ent, nntp_data->newsrc_len * sizeof(struct NewsrcEntry));
+  mutt_mem_realloc(&nntp_data->newsrc_ent, nntp_data->newsrc_len * sizeof(struct NewsrcEntry));
 
   if (save_sort != Sort)
   {
@@ -438,7 +438,7 @@ int nntp_newsrc_update(struct NntpServer *nserv)
     return -1;
 
   buflen = 10 * LONG_STRING;
-  buf = safe_calloc(1, buflen);
+  buf = mutt_mem_calloc(1, buflen);
   off = 0;
 
   /* we will generate full newsrc here */
@@ -453,7 +453,7 @@ int nntp_newsrc_update(struct NntpServer *nserv)
     if (off + strlen(nntp_data->group) + 3 > buflen)
     {
       buflen *= 2;
-      safe_realloc(&buf, buflen);
+      mutt_mem_realloc(&buf, buflen);
     }
     snprintf(buf + off, buflen - off, "%s%c ", nntp_data->group,
              nntp_data->subscribed ? ':' : '!');
@@ -465,7 +465,7 @@ int nntp_newsrc_update(struct NntpServer *nserv)
       if (off + LONG_STRING > buflen)
       {
         buflen *= 2;
-        safe_realloc(&buf, buflen);
+        mutt_mem_realloc(&buf, buflen);
       }
       if (j)
         buf[off++] = ',';
@@ -623,7 +623,7 @@ int nntp_active_save_cache(struct NntpServer *nserv)
     return 0;
 
   buflen = 10 * LONG_STRING;
-  buf = safe_calloc(1, buflen);
+  buf = mutt_mem_calloc(1, buflen);
   snprintf(buf, buflen, "%lu\n", (unsigned long) nserv->newgroups_time);
   off = strlen(buf);
 
@@ -637,7 +637,7 @@ int nntp_active_save_cache(struct NntpServer *nserv)
     if (off + strlen(nntp_data->group) + (nntp_data->desc ? strlen(nntp_data->desc) : 0) + 50 > buflen)
     {
       buflen *= 2;
-      safe_realloc(&buf, buflen);
+      mutt_mem_realloc(&buf, buflen);
     }
     snprintf(buf + off, buflen - off, "%s %d %d %c%s%s\n", nntp_data->group,
              nntp_data->last_message, nntp_data->first_message,
@@ -1006,11 +1006,11 @@ struct NntpServer *nntp_select_server(char *server, bool leave_lock)
   }
 
   /* new news server */
-  nserv = safe_calloc(1, sizeof(struct NntpServer));
+  nserv = mutt_mem_calloc(1, sizeof(struct NntpServer));
   nserv->conn = conn;
   nserv->groups_hash = mutt_hash_create(1009, 0);
   nserv->groups_max = 16;
-  nserv->groups_list = safe_malloc(nserv->groups_max * sizeof(nntp_data));
+  nserv->groups_list = mutt_mem_malloc(nserv->groups_max * sizeof(nntp_data));
 
   rc = nntp_open_connection(nserv);
 
@@ -1178,7 +1178,7 @@ struct NntpData *mutt_newsgroup_subscribe(struct NntpServer *nserv, char *group)
   nntp_data->subscribed = true;
   if (!nntp_data->newsrc_ent)
   {
-    nntp_data->newsrc_ent = safe_calloc(1, sizeof(struct NewsrcEntry));
+    nntp_data->newsrc_ent = mutt_mem_calloc(1, sizeof(struct NewsrcEntry));
     nntp_data->newsrc_len = 1;
     nntp_data->newsrc_ent[0].first = 1;
     nntp_data->newsrc_ent[0].last = 0;
@@ -1225,7 +1225,7 @@ struct NntpData *mutt_newsgroup_catchup(struct NntpServer *nserv, char *group)
 
   if (nntp_data->newsrc_ent)
   {
-    safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
+    mutt_mem_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
     nntp_data->newsrc_len = 1;
     nntp_data->newsrc_ent[0].first = 1;
     nntp_data->newsrc_ent[0].last = nntp_data->last_message;
@@ -1255,7 +1255,7 @@ struct NntpData *mutt_newsgroup_uncatchup(struct NntpServer *nserv, char *group)
 
   if (nntp_data->newsrc_ent)
   {
-    safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
+    mutt_mem_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
     nntp_data->newsrc_len = 1;
     nntp_data->newsrc_ent[0].first = 1;
     nntp_data->newsrc_ent[0].last = nntp_data->first_message - 1;
diff --git a/nntp.c b/nntp.c
index ea9b3d03a2e106b5685a74476344dcbfc3f2c9d3..1b69ac350414e4874c935ae7f3e328a55c349869 100644 (file)
--- a/nntp.c
+++ b/nntp.c
@@ -246,14 +246,14 @@ static int nntp_attempt_features(struct NntpServer *nserv)
 
       if (nserv->overview_fmt)
         FREE(&nserv->overview_fmt);
-      nserv->overview_fmt = safe_malloc(buflen);
+      nserv->overview_fmt = mutt_mem_malloc(buflen);
 
       while (true)
       {
         if (buflen - off < LONG_STRING)
         {
           buflen *= 2;
-          safe_realloc(&nserv->overview_fmt, buflen);
+          mutt_mem_realloc(&nserv->overview_fmt, buflen);
         }
 
         chunk = mutt_socket_readln(nserv->overview_fmt + off, buflen - off, conn);
@@ -293,7 +293,7 @@ static int nntp_attempt_features(struct NntpServer *nserv)
         }
       }
       nserv->overview_fmt[off++] = '\0';
-      safe_realloc(&nserv->overview_fmt, off);
+      mutt_mem_realloc(&nserv->overview_fmt, off);
     }
   }
   return 0;
@@ -843,7 +843,7 @@ static int nntp_fetch_lines(struct NntpData *nntp_data, char *query, size_t qlen
       return 1;
     }
 
-    line = safe_malloc(sizeof(buf));
+    line = mutt_mem_malloc(sizeof(buf));
     rc = 0;
 
     while (true)
@@ -883,7 +883,7 @@ static int nntp_fetch_lines(struct NntpData *nntp_data, char *query, size_t qlen
         off = 0;
       }
 
-      safe_realloc(&line, off + sizeof(buf));
+      mutt_mem_realloc(&line, off + sizeof(buf));
     }
     FREE(&line);
     funct(NULL, data);
@@ -1178,7 +1178,7 @@ static int parse_overview_line(char *line, void *data)
     hdr->read = false;
     hdr->old = false;
     hdr->deleted = false;
-    hdr->data = safe_calloc(1, sizeof(struct NntpHeaderData));
+    hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
     NHDR(hdr)->article_num = anum;
     if (fc->restore)
       hdr->changed = true;
@@ -1227,7 +1227,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
   fc.first = first;
   fc.last = last;
   fc.restore = restore;
-  fc.messages = safe_calloc(last - first + 1, sizeof(unsigned char));
+  fc.messages = mutt_mem_calloc(last - first + 1, sizeof(unsigned char));
 #ifdef USE_HCACHE
   fc.hc = hc;
 #endif
@@ -1393,7 +1393,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
     hdr->read = false;
     hdr->old = false;
     hdr->deleted = false;
-    hdr->data = safe_calloc(1, sizeof(struct NntpHeaderData));
+    hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
     NHDR(hdr)->article_num = current;
     if (restore)
       hdr->changed = true;
@@ -1804,7 +1804,7 @@ static int nntp_group_poll(struct NntpData *nntp_data, int update_stat)
     nntp_data->last_cached = 0;
     if (nntp_data->newsrc_len)
     {
-      safe_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
+      mutt_mem_realloc(&nntp_data->newsrc_ent, sizeof(struct NewsrcEntry));
       nntp_data->newsrc_len = 1;
       nntp_data->newsrc_ent[0].first = 1;
       nntp_data->newsrc_ent[0].last = 0;
@@ -1888,7 +1888,7 @@ static int check_mailbox(struct Context *ctx)
 
     if (NntpContext && nntp_data->last_message - first + 1 > NntpContext)
       first = nntp_data->last_message - NntpContext + 1;
-    messages = safe_calloc(nntp_data->last_loaded - first + 1, sizeof(unsigned char));
+    messages = mutt_mem_calloc(nntp_data->last_loaded - first + 1, sizeof(unsigned char));
     hc = nntp_hcache_open(nntp_data);
     nntp_hcache_update(nntp_data, hc);
 #endif
@@ -1977,7 +1977,7 @@ static int check_mailbox(struct Context *ctx)
         ctx->msgcount++;
         hdr->read = false;
         hdr->old = false;
-        hdr->data = safe_calloc(1, sizeof(struct NntpHeaderData));
+        hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
         NHDR(hdr)->article_num = anum;
         nntp_article_status(ctx, hdr, NULL, anum);
         if (!hdr->read)
@@ -2393,7 +2393,7 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid)
   if (ctx->msgcount == ctx->hdrmax)
     mx_alloc_memory(ctx);
   hdr = ctx->hdrs[ctx->msgcount] = mutt_new_header();
-  hdr->data = safe_calloc(1, sizeof(struct NntpHeaderData));
+  hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
   hdr->env = mutt_read_rfc822_header(fp, hdr, 0, 0);
   mutt_file_fclose(&fp);
   unlink(tempfile);
@@ -2450,7 +2450,7 @@ static int fetch_children(char *line, void *data)
   if (cc->num >= cc->max)
   {
     cc->max *= 2;
-    safe_realloc(&cc->child, sizeof(anum_t) * cc->max);
+    mutt_mem_realloc(&cc->child, sizeof(anum_t) * cc->max);
   }
   cc->child[cc->num++] = anum;
   return 0;
@@ -2477,7 +2477,7 @@ int nntp_check_children(struct Context *ctx, const char *msgid)
   cc.ctx = ctx;
   cc.num = 0;
   cc.max = 10;
-  cc.child = safe_malloc(sizeof(anum_t) * cc.max);
+  cc.child = mutt_mem_malloc(sizeof(anum_t) * cc.max);
 
   /* fetch numbers of child messages */
   snprintf(buf, sizeof(buf), "XPAT References %d-%d *%s*\r\n",
diff --git a/pager.c b/pager.c
index c3f098bab686162673c46309d26f1d25a0c093c2..3104b62baaea3c9a78abdb3d146d106f111daf20 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -447,7 +447,7 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
 
     if (!*quote_list)
     {
-      class = safe_calloc(1, sizeof(struct QClass));
+      class = mutt_mem_calloc(1, sizeof(struct QClass));
       class->color = ColorQuote[0];
       *quote_list = class;
     }
@@ -472,8 +472,8 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
         if (!tmp)
         {
           /* add a node above q_list */
-          tmp = safe_calloc(1, sizeof(struct QClass));
-          tmp->prefix = safe_calloc(1, length + 1);
+          tmp = mutt_mem_calloc(1, sizeof(struct QClass));
+          tmp->prefix = mutt_mem_calloc(1, length + 1);
           strncpy(tmp->prefix, qptr, length);
           tmp->length = length;
 
@@ -582,8 +582,8 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
               if (!tmp)
               {
                 /* add a node above q_list */
-                tmp = safe_calloc(1, sizeof(struct QClass));
-                tmp->prefix = safe_calloc(1, length + 1);
+                tmp = mutt_mem_calloc(1, sizeof(struct QClass));
+                tmp->prefix = mutt_mem_calloc(1, length + 1);
                 strncpy(tmp->prefix, qptr, length);
                 tmp->length = length;
 
@@ -684,8 +684,8 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
         /* still not found so far: add it as a sibling to the current node */
         if (!class)
         {
-          tmp = safe_calloc(1, sizeof(struct QClass));
-          tmp->prefix = safe_calloc(1, length + 1);
+          tmp = mutt_mem_calloc(1, sizeof(struct QClass));
+          tmp->prefix = mutt_mem_calloc(1, length + 1);
           strncpy(tmp->prefix, qptr, length);
           tmp->length = length;
 
@@ -721,8 +721,8 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
   if (!class)
   {
     /* not found so far: add it as a top level class */
-    class = safe_calloc(1, sizeof(struct QClass));
-    class->prefix = safe_calloc(1, length + 1);
+    class = mutt_mem_calloc(1, sizeof(struct QClass));
+    class->prefix = mutt_mem_calloc(1, length + 1);
     strncpy(class->prefix, qptr, length);
     class->length = length;
     new_class_color(class, q_level);
@@ -840,7 +840,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
       if (line_info[i].chunks)
       {
         line_info[i].chunks = 0;
-        safe_realloc(&(line_info[n].syntax), sizeof(struct Syntax));
+        mutt_mem_realloc(&(line_info[n].syntax), sizeof(struct Syntax));
       }
       line_info[i++].type = MT_COLOR_SIGNATURE;
     }
@@ -930,8 +930,8 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
                 break;
               }
               if (++(line_info[n].chunks) > 1)
-                safe_realloc(&(line_info[n].syntax),
-                             (line_info[n].chunks) * sizeof(struct Syntax));
+                mutt_mem_realloc(&(line_info[n].syntax),
+                                 (line_info[n].chunks) * sizeof(struct Syntax));
             }
             i = line_info[n].chunks - 1;
             pmatch[0].rm_so += offset;
@@ -991,8 +991,8 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
             if (!found)
             {
               if (++(line_info[n].chunks) > 1)
-                safe_realloc(&(line_info[n].syntax),
-                             (line_info[n].chunks) * sizeof(struct Syntax));
+                mutt_mem_realloc(&(line_info[n].syntax),
+                                 (line_info[n].chunks) * sizeof(struct Syntax));
             }
             i = line_info[n].chunks - 1;
             pmatch[0].rm_so += offset;
@@ -1164,7 +1164,7 @@ static int fill_buffer(FILE *f, LOFF_T *last_pos, LOFF_T offset, unsigned char *
     b_read = (int) (*last_pos - offset);
     *buf_ready = 1;
 
-    safe_realloc(fmt, *blen);
+    mutt_mem_realloc(fmt, *blen);
 
     /* incomplete mbyte characters trigger a segfault in regex processing for
      * certain versions of glibc. Trim them if necessary. */
@@ -1439,13 +1439,13 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info,
 
   if (*last == *max)
   {
-    safe_realloc(line_info, sizeof(struct Line) * (*max += LINES));
+    mutt_mem_realloc(line_info, sizeof(struct Line) * (*max += LINES));
     for (ch = *last; ch < *max; ch++)
     {
       memset(&((*line_info)[ch]), 0, sizeof(struct Line));
       (*line_info)[ch].type = -1;
       (*line_info)[ch].search_cnt = -1;
-      (*line_info)[ch].syntax = safe_malloc(sizeof(struct Syntax));
+      (*line_info)[ch].syntax = mutt_mem_malloc(sizeof(struct Syntax));
       ((*line_info)[ch].syntax)[0].first = ((*line_info)[ch].syntax)[0].last = -1;
     }
   }
@@ -1514,10 +1514,10 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info,
                    (offset ? REG_NOTBOL : 0)) == 0)
     {
       if (++((*line_info)[n].search_cnt) > 1)
-        safe_realloc(&((*line_info)[n].search),
-                     ((*line_info)[n].search_cnt) * sizeof(struct Syntax));
+        mutt_mem_realloc(&((*line_info)[n].search),
+                         ((*line_info)[n].search_cnt) * sizeof(struct Syntax));
       else
-        (*line_info)[n].search = safe_malloc(sizeof(struct Syntax));
+        (*line_info)[n].search = mutt_mem_malloc(sizeof(struct Syntax));
       pmatch[0].rm_so += offset;
       pmatch[0].rm_eo += offset;
       ((*line_info)[n].search)[(*line_info)[n].search_cnt - 1].first = pmatch[0].rm_so;
@@ -1882,7 +1882,7 @@ static void pager_menu_redraw(struct Menu *pager_menu)
         rd->line_info[i].search_cnt = -1;
         rd->line_info[i].quote = NULL;
 
-        safe_realloc(&(rd->line_info[i].syntax), sizeof(struct Syntax));
+        mutt_mem_realloc(&(rd->line_info[i].syntax), sizeof(struct Syntax));
         if (rd->search_compiled && rd->line_info[i].search)
           FREE(&(rd->line_info[i].search));
       }
@@ -2086,12 +2086,12 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
   }
 
   rd.max_line = LINES; /* number of lines on screen, from curses */
-  rd.line_info = safe_calloc(rd.max_line, sizeof(struct Line));
+  rd.line_info = mutt_mem_calloc(rd.max_line, sizeof(struct Line));
   for (i = 0; i < rd.max_line; i++)
   {
     rd.line_info[i].type = -1;
     rd.line_info[i].search_cnt = -1;
-    rd.line_info[i].syntax = safe_malloc(sizeof(struct Syntax));
+    rd.line_info[i].syntax = mutt_mem_malloc(sizeof(struct Syntax));
     (rd.line_info[i].syntax)[0].first = (rd.line_info[i].syntax)[0].last = -1;
   }
 
@@ -2113,10 +2113,10 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
     snprintf(helpstr, sizeof(helpstr), "%s %s", tmphelp, buffer);
   }
 
-  rd.index_status_window = safe_calloc(1, sizeof(struct MuttWindow));
-  rd.index_window = safe_calloc(1, sizeof(struct MuttWindow));
-  rd.pager_status_window = safe_calloc(1, sizeof(struct MuttWindow));
-  rd.pager_window = safe_calloc(1, sizeof(struct MuttWindow));
+  rd.index_status_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+  rd.index_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+  rd.pager_status_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
+  rd.pager_window = mutt_mem_calloc(1, sizeof(struct MuttWindow));
 
   pager_menu = mutt_new_menu(MENU_PAGER);
   pager_menu->custom_menu_redraw = pager_menu_redraw;
@@ -2254,7 +2254,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
           if (!rd.line_info[i].continuation)
             rd.lines++;
 
-        Resize = safe_malloc(sizeof(struct Resize));
+        Resize = mutt_mem_malloc(sizeof(struct Resize));
 
         Resize->line = rd.lines;
         Resize->search_compiled = rd.search_compiled;
index f37f1c49ec1592a5e18976772822c9dda2aa7964..c7f54e7020da59fe7c387cb2c5975c9c8b7ad07f 100644 (file)
@@ -41,7 +41,7 @@ struct Parameter
  */
 static inline struct Parameter *mutt_new_parameter(void)
 {
-  return safe_calloc(1, sizeof(struct Parameter));
+  return mutt_mem_calloc(1, sizeof(struct Parameter));
 }
 
 void mutt_delete_parameter(const char *attribute, struct Parameter **p);
diff --git a/parse.c b/parse.c
index cc8bdcea4201b03405bdef5194f53df6be1e0a0b..bd98b2c2b71f588da33cfb12aba770622f77e30b 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -106,7 +106,7 @@ char *mutt_read_rfc822_line(FILE *f, char *line, size_t *linelen)
     {
       /* grow the buffer */
       *linelen += STRING;
-      safe_realloc(&line, *linelen);
+      mutt_mem_realloc(&line, *linelen);
       buf = line + offset;
     }
   }
@@ -423,7 +423,7 @@ struct Body *mutt_read_mime_header(FILE *fp, int digest)
 {
   struct Body *p = mutt_new_body();
   char *c = NULL;
-  char *line = safe_malloc(LONG_STRING);
+  char *line = mutt_mem_malloc(LONG_STRING);
   size_t linelen = LONG_STRING;
 
   p->hdr_offset = ftello(fp);
@@ -702,7 +702,7 @@ char *mutt_extract_message_id(const char *s, const char **saveptr)
     if (*p == '>')
     {
       size_t olen = onull - o, slen = p - s + 1;
-      ret = safe_malloc(olen + slen + 1);
+      ret = mutt_mem_malloc(olen + slen + 1);
       if (o)
         memcpy(ret, o, olen);
       memcpy(ret + olen, s, slen);
@@ -1150,7 +1150,7 @@ struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr,
                                          short user_hdrs, short weed)
 {
   struct Envelope *e = mutt_new_envelope();
-  char *line = safe_malloc(LONG_STRING);
+  char *line = mutt_mem_malloc(LONG_STRING);
   char *p = NULL;
   LOFF_T loc;
   size_t linelen = LONG_STRING;
index dad2f08c4474b8f9d0d4b79059c5d0af8b111b9d..9491f9ea97e147f6ee9636bb6cebb657132d216f 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -111,7 +111,7 @@ static bool eat_regex(struct Pattern *pat, struct Buffer *s, struct Buffer *err)
   }
   else
   {
-    pat->p.regex = safe_malloc(sizeof(regex_t));
+    pat->p.regex = mutt_mem_malloc(sizeof(regex_t));
     r = REGCOMP(pat->p.regex, buf.data,
                 REG_NEWLINE | REG_NOSUB | mutt_which_case(buf.data));
     if (r != 0)
@@ -1040,7 +1040,7 @@ static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
     }
 
     blen = STRING;
-    buf = safe_malloc(blen);
+    buf = mutt_mem_malloc(blen);
 
     /* search the file "fp" */
     while (lng > 0)
@@ -1931,7 +1931,7 @@ int mutt_pattern_func(int op, char *prompt)
 
   mutt_buffer_init(&err);
   err.dsize = STRING;
-  err.data = safe_malloc(err.dsize);
+  err.data = mutt_mem_malloc(err.dsize);
   pat = mutt_pattern_comp(buf, MUTT_FULL_MSG, &err);
   if (!pat)
   {
@@ -2066,7 +2066,7 @@ int mutt_search_command(int cur, int op)
       mutt_message(_("Compiling search pattern..."));
       mutt_pattern_free(&SearchPattern);
       err.dsize = STRING;
-      err.data = safe_malloc(err.dsize);
+      err.data = mutt_mem_malloc(err.dsize);
       SearchPattern = mutt_pattern_comp(temp, MUTT_FULL_MSG, &err);
       if (!SearchPattern)
       {
index 114bb8c36321d4773b9de90cca9e80edc73e7bbc..663a43bb53b93485880a46514e687e13e4ced108 100644 (file)
--- a/pattern.h
+++ b/pattern.h
@@ -86,7 +86,7 @@ struct PatternCache
 
 static inline struct Pattern *new_pattern(void)
 {
-  return safe_calloc(1, sizeof(struct Pattern));
+  return mutt_mem_calloc(1, sizeof(struct Pattern));
 }
 
 int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags,
index de1653df060d9049783745344bbd4d731777df66..3eb894b137034d16a13fd19b9b6bcff7bb932cb2 100644 (file)
@@ -224,7 +224,7 @@ static char *binary_fingerprint_to_string(unsigned char *buff, size_t length)
 {
   char *fingerprint = NULL, *pf = NULL;
 
-  pf = fingerprint = safe_malloc((length * 2) + 1);
+  pf = fingerprint = mutt_mem_malloc((length * 2) + 1);
 
   for (int i = 0; i < length; i++)
   {
@@ -685,7 +685,8 @@ static struct PgpKeyInfo *pgp_parse_keyblock(FILE *fp)
       {
         if (lsig)
         {
-          struct PgpSignature *signature = safe_calloc(1, sizeof(struct PgpSignature));
+          struct PgpSignature *signature =
+              mutt_mem_calloc(1, sizeof(struct PgpSignature));
           *lsig = signature;
           lsig = &signature->next;
 
@@ -717,14 +718,14 @@ static struct PgpKeyInfo *pgp_parse_keyblock(FILE *fp)
         if (!addr)
           break;
 
-        chr = safe_malloc(l);
+        chr = mutt_mem_malloc(l);
         if (l > 0)
         {
           memcpy(chr, buff + 1, l - 1);
           chr[l - 1] = '\0';
         }
 
-        *addr = uid = safe_calloc(1, sizeof(struct PgpUid)); /* XXX */
+        *addr = uid = mutt_mem_calloc(1, sizeof(struct PgpUid)); /* XXX */
         uid->addr = chr;
         uid->parent = p;
         uid->trust = 0;
@@ -776,7 +777,7 @@ static void pgpring_find_candidates(char *ringfile, const char *hints[], int nhi
     size_t error_buf_len;
 
     error_buf_len = sizeof("fopen: ") - 1 + strlen(ringfile) + 1;
-    error_buf = safe_malloc(error_buf_len);
+    error_buf = mutt_mem_malloc(error_buf_len);
     snprintf(error_buf, error_buf_len, "fopen: %s", ringfile);
     perror(error_buf);
     FREE(&error_buf);
@@ -799,7 +800,7 @@ static void pgpring_find_candidates(char *ringfile, const char *hints[], int nhi
     }
     else if (pt == PT_NAME)
     {
-      char *tmp = safe_malloc(l);
+      char *tmp = mutt_mem_malloc(l);
 
       memcpy(tmp, buff + 1, l - 1);
       tmp[l - 1] = '\0';
diff --git a/pop.c b/pop.c
index e0d18a23a10b125fee86b9098dc15c0fc5c45ec5..9e886c238f843bfd78836a5fc51dc85ae1fad53d 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -449,7 +449,7 @@ static int pop_open_mailbox(struct Context *ctx)
   ctx->path = safe_strdup(buf);
   ctx->realpath = safe_strdup(ctx->path);
 
-  pop_data = safe_calloc(1, sizeof(struct PopData));
+  pop_data = mutt_mem_calloc(1, sizeof(struct PopData));
   pop_data->conn = conn;
   ctx->data = pop_data;
 
@@ -832,7 +832,7 @@ void pop_fetch_mail(void)
     return;
   }
 
-  url = p = safe_calloc(strlen(PopHost) + 7, sizeof(char));
+  url = p = mutt_mem_calloc(strlen(PopHost) + 7, sizeof(char));
   if (url_check_scheme(PopHost) == U_UNKNOWN)
   {
     strcpy(url, "pop://");
@@ -852,7 +852,7 @@ void pop_fetch_mail(void)
   if (!conn)
     return;
 
-  pop_data = safe_calloc(1, sizeof(struct PopData));
+  pop_data = mutt_mem_calloc(1, sizeof(struct PopData));
   pop_data->conn = conn;
 
   if (pop_open_connection(pop_data) < 0)
index 8fcf2a4ca8bf5ccfe83600e0e8ded8dc8c84d832..a85a646c838c1a2dd0c0fd4a8f9dda1cb8b81374 100644 (file)
@@ -90,7 +90,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopData *pop_data, const char *metho
   mutt_message(_("Authenticating (SASL)..."));
 
   bufsize = ((olen * 2) > LONG_STRING) ? (olen * 2) : LONG_STRING;
-  buf = safe_malloc(bufsize);
+  buf = mutt_mem_malloc(bufsize);
 
   snprintf(buf, bufsize, "AUTH %s", mech);
   olen = strlen(buf);
@@ -149,7 +149,7 @@ static enum PopAuthRes pop_auth_sasl(struct PopData *pop_data, const char *metho
       if ((olen * 2) > bufsize)
       {
         bufsize = olen * 2;
-        safe_realloc(&buf, bufsize);
+        mutt_mem_realloc(&buf, bufsize);
       }
       if (sasl_encode64(pc, olen, buf, bufsize, &olen) != SASL_OK)
       {
index 01a36cf45574cf74d12d90164205d8d06543a9f1..659b01abbfbb61ace6546781bc769935c7bc5426 100644 (file)
--- a/pop_lib.c
+++ b/pop_lib.c
@@ -162,12 +162,12 @@ static int fetch_auth(char *line, void *data)
 
   if (!pop_data->auth_list)
   {
-    pop_data->auth_list = safe_malloc(strlen(line) + 1);
+    pop_data->auth_list = mutt_mem_malloc(strlen(line) + 1);
     *pop_data->auth_list = '\0';
   }
   else
   {
-    safe_realloc(&pop_data->auth_list, strlen(pop_data->auth_list) + strlen(line) + 2);
+    mutt_mem_realloc(&pop_data->auth_list, strlen(pop_data->auth_list) + strlen(line) + 2);
     strcat(pop_data->auth_list, " ");
   }
   strcat(pop_data->auth_list, line);
@@ -523,7 +523,7 @@ int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progr
   if (ret < 0)
     return ret;
 
-  inbuf = safe_malloc(sizeof(buf));
+  inbuf = mutt_mem_malloc(sizeof(buf));
 
   while (true)
   {
@@ -560,7 +560,7 @@ int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progr
       lenbuf = 0;
     }
 
-    safe_realloc(&inbuf, lenbuf + sizeof(buf));
+    mutt_mem_realloc(&inbuf, lenbuf + sizeof(buf));
   }
 
   FREE(&inbuf);
diff --git a/query.c b/query.c
index c4357170078cf6e780cd83aac9682539a0c2e1cc..41611fd1dfb50bdf2dfa67de73ff26082649e220 100644 (file)
--- a/query.c
+++ b/query.c
@@ -144,12 +144,12 @@ static struct Query *run_query(char *s, int quiet)
     {
       if (!first)
       {
-        first = safe_calloc(1, sizeof(struct Query));
+        first = mutt_mem_calloc(1, sizeof(struct Query));
         cur = first;
       }
       else
       {
-        cur->next = safe_calloc(1, sizeof(struct Query));
+        cur->next = mutt_mem_calloc(1, sizeof(struct Query));
         cur = cur->next;
       }
 
@@ -309,7 +309,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, int retb
     for (queryp = results; queryp; queryp = queryp->next)
       menu->max++;
 
-    menu->data = QueryTable = safe_calloc(menu->max, sizeof(struct Entry));
+    menu->data = QueryTable = mutt_mem_calloc(menu->max, sizeof(struct Entry));
 
     for (i = 0, queryp = results; queryp; queryp = queryp->next, i++)
       QueryTable[i].data = queryp;
@@ -363,7 +363,8 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, int retb
 
               if (op == OP_QUERY)
               {
-                menu->data = QueryTable = safe_calloc(menu->max, sizeof(struct Entry));
+                menu->data = QueryTable =
+                    mutt_mem_calloc(menu->max, sizeof(struct Entry));
 
                 for (i = 0, queryp = results; queryp; queryp = queryp->next, i++)
                   QueryTable[i].data = queryp;
@@ -373,7 +374,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, int retb
                 bool clear = false;
 
                 /* append */
-                safe_realloc(&QueryTable, menu->max * sizeof(struct Entry));
+                mutt_mem_realloc(&QueryTable, menu->max * sizeof(struct Entry));
 
                 menu->data = QueryTable;
 
index 3bbbab30295f8a4f5aa68185ede70f37c2a0b393..50b9438d91d110696440baefc3aeee923d057023 100644 (file)
@@ -1016,7 +1016,7 @@ static void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Header
     }
     else
     {
-      new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
+      new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr));
       mutt_actx_add_attach(actx, new);
 
       new->content = m;
@@ -1137,7 +1137,7 @@ void mutt_view_attachments(struct Header *hdr)
   menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_ATTACH, AttachHelp);
   mutt_push_current_menu(menu);
 
-  actx = safe_calloc(sizeof(struct AttachCtx), 1);
+  actx = mutt_mem_calloc(sizeof(struct AttachCtx), 1);
   actx->hdr = hdr;
   actx->root_fp = msg->fp;
   mutt_update_recvattach_menu(actx, menu, 1);
index 4830c22b2e7f19672c032725d278d61717a4de2f..ee7863a8e980c3b47cc1629afff901d485490509 100644 (file)
@@ -100,7 +100,7 @@ static void mix_add_entry(struct Remailer ***type2_list, struct Remailer *entry,
   if (*used == *slots)
   {
     *slots += 5;
-    safe_realloc(type2_list, sizeof(struct Remailer *) * (*slots));
+    mutt_mem_realloc(type2_list, sizeof(struct Remailer *) * (*slots));
   }
 
   (*type2_list)[(*used)++] = entry;
@@ -110,7 +110,7 @@ static void mix_add_entry(struct Remailer ***type2_list, struct Remailer *entry,
 
 static struct Remailer *mix_new_remailer(void)
 {
-  return safe_calloc(1, sizeof(struct Remailer));
+  return mutt_mem_calloc(1, sizeof(struct Remailer));
 }
 
 static void mix_free_remailer(struct Remailer **r)
@@ -232,7 +232,7 @@ static void mix_screen_coordinates(struct Remailer **type2_list, struct Coord **
   if (!chain->cl)
     return;
 
-  safe_realloc(coordsp, sizeof(struct Coord) * chain->cl);
+  mutt_mem_realloc(coordsp, sizeof(struct Coord) * chain->cl);
 
   coords = *coordsp;
 
@@ -481,7 +481,7 @@ void mix_make_chain(struct ListHead *chainhead)
     return;
   }
 
-  chain = safe_calloc(1, sizeof(struct MixChain));
+  chain = mutt_mem_calloc(1, sizeof(struct MixChain));
 
   struct ListNode *p;
   STAILQ_FOREACH(p, chainhead, entries)
index 1b070109966c84526e16ee65acc352ed4ef5e6eb..6dfd4ca7402522ad1e8ab24f7d49ad31037bf031 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -300,7 +300,7 @@ static int rfc1524_mailcap_parse(struct Body *a, char *filename, char *type,
           if (get_field_text(field + 4, &test_command, type, filename, line) && test_command)
           {
             len = mutt_strlen(test_command) + STRING;
-            safe_realloc(&test_command, len);
+            mutt_mem_realloc(&test_command, len);
             rfc1524_expand_command(a, a->filename, type, test_command, len);
             if (mutt_system(test_command) != 0)
             {
@@ -362,7 +362,7 @@ static int rfc1524_mailcap_parse(struct Body *a, char *filename, char *type,
  */
 struct Rfc1524MailcapEntry *rfc1524_new_entry(void)
 {
-  return safe_calloc(1, sizeof(struct Rfc1524MailcapEntry));
+  return mutt_mem_calloc(1, sizeof(struct Rfc1524MailcapEntry));
 }
 
 /**
index 0da5fd1b721744430ebc5f2aaa431a6f4c1f8dda..fb1087c6034fcb3ecd4a5a254d493527fea5614d 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -67,7 +67,7 @@ static size_t convert_string(ICONV_CONST char *f, size_t flen, const char *from,
   if (cd == (iconv_t)(-1))
     return (size_t)(-1);
   obl = 4 * flen + 1;
-  ob = buf = safe_malloc(obl);
+  ob = buf = mutt_mem_malloc(obl);
   n = iconv(cd, &f, &flen, &ob, &obl);
   if (n == (size_t)(-1) || iconv(cd, 0, 0, &ob, &obl) == (size_t)(-1))
   {
@@ -81,7 +81,7 @@ static size_t convert_string(ICONV_CONST char *f, size_t flen, const char *from,
 
   *tlen = ob - buf;
 
-  safe_realloc(&buf, ob - buf + 1);
+  mutt_mem_realloc(&buf, ob - buf + 1);
   *t = buf;
   iconv_close(cd);
 
@@ -108,7 +108,7 @@ int convert_nonmime_string(char **ps)
     n = c1 ? c1 - c : mutt_strlen(c);
     if (!n)
       return 0;
-    fromcode = safe_malloc(n + 1);
+    fromcode = mutt_mem_malloc(n + 1);
     strfcpy(fromcode, c, n + 1);
     m = convert_string(u, ulen, fromcode, Charset, &s, &slen);
     FREE(&fromcode);
@@ -143,7 +143,7 @@ char *mutt_choose_charset(const char *fromcode, const char *charsets, char *u,
     if (!n)
       continue;
 
-    t = safe_malloc(n + 1);
+    t = mutt_mem_malloc(n + 1);
     memcpy(t, p, n);
     t[n] = '\0';
 
@@ -444,7 +444,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char
   {
     ret = 1;
     icode = 0;
-    safe_realloc(&u, (ulen = dlen) + 1);
+    mutt_mem_realloc(&u, (ulen = dlen) + 1);
     memcpy(u, d, dlen);
     u[ulen] = 0;
   }
@@ -537,7 +537,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char
 
   /* Initialise the output buffer with the us-ascii prefix. */
   buflen = 2 * ulen;
-  buf = safe_malloc(buflen);
+  buf = mutt_mem_malloc(buflen);
   bufpos = t0 - u;
   memcpy(buf, u, t0 - u);
 
@@ -580,7 +580,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char
     if ((bufpos + wlen + lb_len) > buflen)
     {
       buflen = bufpos + wlen + lb_len;
-      safe_realloc(&buf, buflen);
+      mutt_mem_realloc(&buf, buflen);
     }
     r = encode_block(buf + bufpos, t, n, icode, tocode, encoder);
     assert(r == wlen);
@@ -595,7 +595,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char
 
   /* Add last encoded word and us-ascii suffix to buffer. */
   buflen = bufpos + wlen + (u + ulen - t1);
-  safe_realloc(&buf, buflen + 1);
+  mutt_mem_realloc(&buf, buflen + 1);
   r = encode_block(buf + bufpos, t, t1 - t, icode, tocode, encoder);
   assert(r == wlen);
   bufpos += wlen;
@@ -655,7 +655,7 @@ static int rfc2047_decode_word(char *d, const char *s, size_t len)
   char *charset = NULL;
   int rv = -1;
 
-  pd = d0 = safe_malloc(strlen(s) + 1);
+  pd = d0 = mutt_mem_malloc(strlen(s) + 1);
 
   for (pp = s; (pp1 = strchr(pp, '?')); pp = pp1 + 1)
   {
@@ -798,7 +798,7 @@ void rfc2047_decode(char **pd)
     return;
 
   dlen = 4 * strlen(s); /* should be enough */
-  d = d0 = safe_malloc(dlen + 1);
+  d = d0 = mutt_mem_malloc(dlen + 1);
 
   while (*s && dlen > 0)
   {
@@ -826,7 +826,7 @@ void rfc2047_decode(char **pd)
         size_t tlen;
 
         n = mutt_strlen(s);
-        t = safe_malloc(n + 1);
+        t = mutt_mem_malloc(n + 1);
         strfcpy(t, s, n + 1);
         convert_nonmime_string(&t);
         tlen = mutt_strlen(t);
index ed23aa573de2b340d99dfce0c0dc0f2ba86cfbad..41d3e0d1b8abf6b341dc1ec873f106b6e0e4b074 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -116,7 +116,7 @@ static void rfc2231_decode_one(char *dest, char *src)
 
 static struct Rfc2231Parameter *rfc2231_new_parameter(void)
 {
-  return safe_calloc(1, sizeof(struct Rfc2231Parameter));
+  return mutt_mem_calloc(1, sizeof(struct Rfc2231Parameter));
 }
 
 /**
@@ -189,7 +189,7 @@ static void rfc2231_join_continuations(struct Parameter **head, struct Rfc2231Pa
 
       vl = strlen(par->value);
 
-      safe_realloc(&value, l + vl + 1);
+      mutt_mem_realloc(&value, l + vl + 1);
       strcpy(value + l, par->value);
       l += vl;
 
@@ -349,7 +349,7 @@ int rfc2231_encode_string(char **pd)
 
   if (encode)
   {
-    e = safe_malloc(dlen + 2 * ext + strlen(charset) + 3);
+    e = mutt_mem_malloc(dlen + 2 * ext + strlen(charset) + 3);
     sprintf(e, "%s''", charset);
     t = e + strlen(e);
     for (s = d, slen = dlen; slen; s++, slen--)
index 3d604c0e824b72dd019c5f8ab533b17c93f46831..4560ee32ba7262466e49975523478a8cf37bd4f9 100644 (file)
--- a/rfc822.c
+++ b/rfc822.c
@@ -647,7 +647,7 @@ void rfc822_qualify(struct Address *addr, const char *host)
   for (; addr; addr = addr->next)
     if (!addr->group && addr->mailbox && strchr(addr->mailbox, '@') == NULL)
     {
-      p = safe_malloc(mutt_strlen(addr->mailbox) + mutt_strlen(host) + 2);
+      p = mutt_mem_malloc(mutt_strlen(addr->mailbox) + mutt_strlen(host) + 2);
       sprintf(p, "%s@%s", addr->mailbox, host);
       FREE(&addr->mailbox);
       addr->mailbox = p;
index cc63232ddd2f4b4aa5a842f6867e610e7d61ca17..b4c287b249f0e0475f4b77bff581c2bb443eedf7 100644 (file)
--- a/rfc822.h
+++ b/rfc822.h
@@ -68,7 +68,7 @@ extern const char *const RFC822Errors[];
  */
 static inline struct Address *rfc822_new_address(void)
 {
-  return safe_calloc(1, sizeof(struct Address));
+  return mutt_mem_calloc(1, sizeof(struct Address));
 }
 
 #endif /* _MUTT_RFC822_H */
index f9e35ef7cd5f17b46c314b96ff804f628144fe2e..56e51f532db931f609fddb6775a6b3c9e5e52dcd 100644 (file)
@@ -69,7 +69,7 @@ int safe_asprintf(char **strp, const char *fmt, ...)
   int rlen = STRING;
   int n;
 
-  *strp = safe_malloc(rlen);
+  *strp = mutt_mem_malloc(rlen);
   for (;;)
   {
     va_list ap;
@@ -90,12 +90,12 @@ int safe_asprintf(char **strp, const char *fmt, ...)
       if (n == 0) /* convention is to use NULL for zero-length strings. */
         FREE(strp);
       else if (n != rlen - 1)
-        safe_realloc(strp, n + 1);
+        mutt_mem_realloc(strp, n + 1);
       return n;
     }
     /* increase size and try again */
     rlen = n + 1;
-    safe_realloc(strp, rlen);
+    mutt_mem_realloc(strp, rlen);
   }
   /* not reached */
 }
diff --git a/score.c b/score.c
index c9b5db88cba67ab34d6e051b9a0aa92e23e6412d..d728ab821d02c1af103e187dade53819c5fb15dc 100644 (file)
--- a/score.c
+++ b/score.c
@@ -109,7 +109,7 @@ int mutt_parse_score(struct Buffer *buf, struct Buffer *s, unsigned long data,
       FREE(&pattern);
       return -1;
     }
-    ptr = safe_calloc(1, sizeof(struct Score));
+    ptr = mutt_mem_calloc(1, sizeof(struct Score));
     if (last)
       last->next = ptr;
     else
diff --git a/send.c b/send.c
index 0859e2e1324e2998522a8b304b427d5cad0cd54e..6ae6909a5c3490ee0d4c1c975184f9ec5737c45c 100644 (file)
--- a/send.c
+++ b/send.c
@@ -715,7 +715,7 @@ void mutt_make_misc_reply_headers(struct Envelope *env, struct Context *ctx,
   if (curenv->real_subj)
   {
     FREE(&env->subject);
-    env->subject = safe_malloc(mutt_strlen(curenv->real_subj) + 5);
+    env->subject = mutt_mem_malloc(mutt_strlen(curenv->real_subj) + 5);
     sprintf(env->subject, "Re: %s", curenv->real_subj);
   }
   else if (!env->subject)
@@ -1073,7 +1073,7 @@ struct Address *mutt_default_from(void)
   else if (option(OPT_USE_DOMAIN))
   {
     adr = rfc822_new_address();
-    adr->mailbox = safe_malloc(mutt_strlen(Username) + mutt_strlen(fqdn) + 2);
+    adr->mailbox = mutt_mem_malloc(mutt_strlen(Username) + mutt_strlen(fqdn) + 2);
     sprintf(adr->mailbox, "%s@%s", NONULL(Username), NONULL(fqdn));
   }
   else
@@ -1290,7 +1290,7 @@ static int search_attach_keyword(char *filename)
   if (!attf)
     return 0;
 
-  char *inputline = safe_malloc(LONG_STRING);
+  char *inputline = mutt_mem_malloc(LONG_STRING);
   int found = 0;
   while (!feof(attf))
   {
index aa7a904fff460f7396837d15eee1c493a5164dd6..640e4870a4f5e4074bb2b59134a11c4e1e8d7c9b 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -694,10 +694,10 @@ static size_t convert_file_to(FILE *file, const char *fromcode, int ncodes,
   if (cd1 == (iconv_t)(-1))
     return -1;
 
-  cd = safe_calloc(ncodes, sizeof(iconv_t));
-  score = safe_calloc(ncodes, sizeof(size_t));
-  states = safe_calloc(ncodes, sizeof(struct ContentState));
-  infos = safe_calloc(ncodes, sizeof(struct Content));
+  cd = mutt_mem_calloc(ncodes, sizeof(iconv_t));
+  score = mutt_mem_calloc(ncodes, sizeof(size_t));
+  states = mutt_mem_calloc(ncodes, sizeof(struct ContentState));
+  infos = mutt_mem_calloc(ncodes, sizeof(struct Content));
 
   for (int i = 0; i < ncodes; i++)
   {
@@ -845,7 +845,7 @@ static size_t convert_file_from_to(FILE *file, const char *fromcodes, const char
   }
 
   /* Copy them */
-  tcode = safe_malloc(ncodes * sizeof(char *));
+  tcode = mutt_mem_malloc(ncodes * sizeof(char *));
   for (c = tocodes, i = 0; c; c = c1 ? c1 + 1 : 0, i++)
   {
     c1 = strchr(c, ':');
@@ -937,7 +937,7 @@ struct Content *mutt_get_content_info(const char *fname, struct Body *b)
     return NULL;
   }
 
-  info = safe_calloc(1, sizeof(struct Content));
+  info = mutt_mem_calloc(1, sizeof(struct Content));
   memset(&state, 0, sizeof(state));
 
   if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset))
@@ -1656,7 +1656,7 @@ void mutt_write_references(const struct ListHead *r, FILE *f, size_t trim)
       break;
   }
 
-  struct ListNode **ref = safe_calloc(length, sizeof(struct ListNode *));
+  struct ListNode **ref = mutt_mem_calloc(length, sizeof(struct ListNode *));
 
   // store in reverse order
   size_t tmp = length;
@@ -2202,7 +2202,7 @@ static void encode_headers(struct ListHead *h)
       continue;
 
     rfc2047_encode_string32(&tmp);
-    safe_realloc(&np->data, mutt_strlen(np->data) + 2 + mutt_strlen(tmp) + 1);
+    mutt_mem_realloc(&np->data, mutt_strlen(np->data) + 2 + mutt_strlen(tmp) + 1);
 
     sprintf(np->data + i, ": %s", NONULL(tmp));
 
@@ -2440,7 +2440,7 @@ static char **add_args(char **args, size_t *argslen, size_t *argsmax, struct Add
     if (addr->mailbox && !addr->group)
     {
       if (*argslen == *argsmax)
-        safe_realloc(&args, (*argsmax += 5) * sizeof(char *));
+        mutt_mem_realloc(&args, (*argsmax += 5) * sizeof(char *));
       args[(*argslen)++] = addr->mailbox;
     }
   }
@@ -2450,7 +2450,7 @@ static char **add_args(char **args, size_t *argslen, size_t *argsmax, struct Add
 static char **add_option(char **args, size_t *argslen, size_t *argsmax, char *s)
 {
   if (*argslen == *argsmax)
-    safe_realloc(&args, (*argsmax += 5) * sizeof(char *));
+    mutt_mem_realloc(&args, (*argsmax += 5) * sizeof(char *));
   args[(*argslen)++] = s;
   return args;
 }
@@ -2506,7 +2506,7 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres
   while ((ps = strtok(ps, " ")))
   {
     if (argslen == argsmax)
-      safe_realloc(&args, sizeof(char *) * (argsmax += 5));
+      mutt_mem_realloc(&args, sizeof(char *) * (argsmax += 5));
 
     if (i)
     {
@@ -2540,7 +2540,7 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres
       while ((ps = strtok(ps, " ")))
       {
         if (extra_argslen == extra_argsmax)
-          safe_realloc(&extra_args, sizeof(char *) * (extra_argsmax += 5));
+          mutt_mem_realloc(&extra_args, sizeof(char *) * (extra_argsmax += 5));
 
         extra_args[extra_argslen++] = ps;
         ps = NULL;
@@ -2585,7 +2585,7 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres
 #endif
 
   if (argslen == argsmax)
-    safe_realloc(&args, sizeof(char *) * (++argsmax));
+    mutt_mem_realloc(&args, sizeof(char *) * (++argsmax));
 
   args[argslen++] = NULL;
 
index 3681e51a60e3de8c38d3b1e240e573fc4c4ce525..0086583338326e44b0c8363271dfedd56c81cbab 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -910,7 +910,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width)
           tmp_folder_name += lastsep; /* basename */
         int sfn_len = mutt_strlen(tmp_folder_name) +
                       sidebar_folder_depth * mutt_strlen(SidebarIndentString) + 1;
-        sidebar_folder_name = safe_malloc(sfn_len);
+        sidebar_folder_name = mutt_mem_malloc(sfn_len);
         sidebar_folder_name[0] = 0;
         for (int i = 0; i < sidebar_folder_depth; i++)
           safe_strcat(sidebar_folder_name, sfn_len, NONULL(SidebarIndentString));
@@ -1112,9 +1112,9 @@ void mutt_sb_notify_mailbox(struct Buffy *b, int created)
     if (EntryCount >= EntryLen)
     {
       EntryLen += 10;
-      safe_realloc(&Entries, EntryLen * sizeof(struct SbEntry *));
+      mutt_mem_realloc(&Entries, EntryLen * sizeof(struct SbEntry *));
     }
-    Entries[EntryCount] = safe_calloc(1, sizeof(struct SbEntry));
+    Entries[EntryCount] = mutt_mem_calloc(1, sizeof(struct SbEntry));
     Entries[EntryCount]->buffy = b;
 
     if (TopIndex < 0)
diff --git a/smtp.c b/smtp.c
index 9e34099812fadc0dcfdb45c592ae3a8eb35211ae..60074275e7b50855287d9c51e3904b6e3896615e 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -389,7 +389,7 @@ static int smtp_auth_sasl(struct Connection *conn, const char *mechlist)
     mutt_message(_("Authenticating (%s)..."), mech);
 
   bufsize = ((len * 2) > LONG_STRING) ? (len * 2) : LONG_STRING;
-  buf = safe_malloc(bufsize);
+  buf = mutt_mem_malloc(bufsize);
 
   snprintf(buf, bufsize, "AUTH %s", mech);
   if (len)
@@ -435,7 +435,7 @@ static int smtp_auth_sasl(struct Connection *conn, const char *mechlist)
       if ((len * 2) > bufsize)
       {
         bufsize = len * 2;
-        safe_realloc(&buf, bufsize);
+        mutt_mem_realloc(&buf, bufsize);
       }
       if (sasl_encode64(data, len, buf, bufsize, &len) != SASL_OK)
       {
index 2991928db724d7fed125bcade19c38044cd2ce1f..b177f6620c60725a775cf002b55dfb0a68b0f117 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -267,8 +267,8 @@ void mutt_draw_tree(struct Context *ctx)
    * From now on we can simply ignore invisible subtrees
    */
   calculate_visibility(ctx, &max_depth);
-  pfx = safe_malloc(width * max_depth + 2);
-  arrow = safe_malloc(width * max_depth + 2);
+  pfx = mutt_mem_malloc(width * max_depth + 2);
+  arrow = mutt_mem_malloc(width * max_depth + 2);
   while (tree)
   {
     if (depth)
@@ -289,7 +289,7 @@ void mutt_draw_tree(struct Context *ctx)
       {
         myarrow[width] = MUTT_TREE_RARROW;
         myarrow[width + 1] = 0;
-        new_tree = safe_malloc((2 + depth * width));
+        new_tree = mutt_mem_malloc((2 + depth * width));
         if (start_depth > 1)
         {
           strncpy(new_tree, pfx, (start_depth - 1) * width);
@@ -639,7 +639,7 @@ struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, int init)
 
   top = thread;
 
-  array = safe_calloc((array_size = 256), sizeof(struct MuttThread *));
+  array = mutt_mem_calloc((array_size = 256), sizeof(struct MuttThread *));
   while (true)
   {
     if (init || !thread->sort_key)
@@ -678,7 +678,7 @@ struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, int init)
         for (i = 0; thread; i++, thread = thread->prev)
         {
           if (i >= array_size)
-            safe_realloc(&array, (array_size *= 2) * sizeof(struct MuttThread *));
+            mutt_mem_realloc(&array, (array_size *= 2) * sizeof(struct MuttThread *));
 
           array[i] = thread;
         }
@@ -865,7 +865,7 @@ void mutt_sort_threads(struct Context *ctx, int init)
       {
         new = (option(OPT_DUPLICATE_THREADS) ? thread : NULL);
 
-        thread = safe_calloc(1, sizeof(struct MuttThread));
+        thread = mutt_mem_calloc(1, sizeof(struct MuttThread));
         thread->message = cur;
         thread->check_subject = true;
         cur->thread = thread;
@@ -958,7 +958,7 @@ void mutt_sort_threads(struct Context *ctx, int init)
       new = mutt_hash_find(ctx->thread_hash, ref->data);
       if (!new)
       {
-        new = safe_calloc(1, sizeof(struct MuttThread));
+        new = mutt_mem_calloc(1, sizeof(struct MuttThread));
         mutt_hash_insert(ctx->thread_hash, ref->data, new);
       }
       else
diff --git a/url.c b/url.c
index 37567d274462531464740a52334bea14d5c8d208..6e2ad4ea6df528a010e912a36ecd38b5ce0dc904 100644 (file)
--- a/url.c
+++ b/url.c
@@ -104,7 +104,7 @@ static int parse_query_string(struct Url *u, char *src)
 
   while (src && *src)
   {
-    qs = safe_calloc(1, sizeof(struct UrlQueryString));
+    qs = mutt_mem_calloc(1, sizeof(struct UrlQueryString));
     if ((k = strchr(src, '&')))
       *k = '\0';