X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=smime.c;h=728d1115aa3e3fe2adb904e18cadb04667f9880a;hp=cba710063687f1f2642699ab6882d2757420799f;hb=b3cb6ed8d36c550a2e589910ce51bbc8352ff57c;hpb=4eaac5c4a87b84ea9ec0668b4e088ac27e2d1106 diff --git a/smime.c b/smime.c index cba7100..728d111 100644 --- a/smime.c +++ b/smime.c @@ -13,6 +13,8 @@ # include "config.h" #endif +#include + #include "mutt.h" #include "enter.h" #include "handler.h" @@ -389,7 +391,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public) } /* Read Entries */ cur = 0; - Table = mem_calloc (cert_num, sizeof (smime_id)); + Table = p_new(smime_id, cert_num); while (!feof (index)) { numFields = fscanf (index, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING), @@ -455,14 +457,14 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public) } } if (hash) { - fname = mem_malloc (13); /* Hash + '.' + Suffix + \0 */ + fname = p_new(char, 13); /* Hash + '.' + Suffix + \0 */ sprintf (fname, "%.8x.%i", Table[cur].hash, Table[cur].suffix); } else fname = NULL; mutt_menuDestroy (&menu); - mem_free (&Table); + p_delete(&Table); set_option (OPTNEEDREDRAW); if (fname) @@ -649,7 +651,7 @@ void _smime_getkeys (char *mailbox) /* the key used last time. */ if (*SmimeKeyToUse && !str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) { - mem_free (&k); + p_delete(&k); return; } else @@ -664,7 +666,7 @@ void _smime_getkeys (char *mailbox) if (str_casecmp (k, SmimeDefaultKey)) smime_void_passphrase (); - mem_free (&k); + p_delete(&k); return; } @@ -766,7 +768,7 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc) } if (!keyID) { mutt_message (_("No (valid) certificate found for %s."), q->mailbox); - mem_free (&keylist); + p_delete(&keylist); rfc822_free_address (&tmp); rfc822_free_address (&addr); return NULL; @@ -854,14 +856,13 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, if (copy && buffer && num) { (*num) = count; - *buffer = mem_calloc (sizeof (char *), count); + *buffer = p_new(char *, count); count = 0; rewind (fpout); while ((fgets (email, sizeof (email), fpout))) { *(email + str_len (email) - 1) = '\0'; - (*buffer)[count] = mem_calloc (1, str_len (email) + 1); - strncpy ((*buffer)[count], email, str_len (email)); + (*buffer)[count] = p_dupstr(email, str_len(email)); count++; } } @@ -1091,7 +1092,7 @@ void smime_invoke_import (char *infile, char *mailbox) mutt_wait_filter (thepid); mutt_unlink (certfile); - mem_free (&certfile); + p_delete(&certfile); } fflush (fpout); @@ -1150,7 +1151,7 @@ int smime_verify_sender (HEADER * h) else retval = 0; mutt_unlink (certfile); - mem_free (&certfile); + p_delete(&certfile); } else mutt_any_key_to_continue (_("no certfile")); @@ -1567,7 +1568,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile) if (linelen && !str_casecmp (line, "verification successful")) badsig = 0; - mem_free (&line); + p_delete(&line); } } @@ -1780,7 +1781,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) line = mutt_read_line (line, &linelen, smimeerr, &lineno); if (linelen && !str_casecmp (line, "verification successful")) m->goodsig = 1; - mem_free (&line); + p_delete(&line); } else { m->goodsig = p->goodsig; @@ -1935,7 +1936,7 @@ int smime_send_menu (HEADER * msg, int *redraw) break; case 4: /* (c)lear */ - mem_free (&SmimeCryptAlg); + p_delete(&SmimeCryptAlg); /* fallback */ case -1: /* Ctrl-G or Enter */ choice = 0;