fix regressions
[apps/madmutt.git] / recvattach.c
index d0272e3..e71d85b 100644 (file)
@@ -12,6 +12,8 @@
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
 #include "ascii.h"
 #include "enter.h"
@@ -62,7 +64,7 @@ static struct mapping_t AttachHelp[] = {
 
 static int mutt_extract_path (char *filename, char *path)
 {
-  char *tmp = mem_malloc (sizeof (char) * _POSIX_PATH_MAX);
+  char *tmp = p_new(char, _POSIX_PATH_MAX);
   char *help_ptr;
 
   help_ptr = tmp;
@@ -76,7 +78,7 @@ static int mutt_extract_path (char *filename, char *path)
     }
     *help_ptr++ = *filename++;
   }
-  mem_free (&tmp);
+  p_delete(&tmp);
   return 0;
 }
 
@@ -144,7 +146,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY * m,
     }
     else {
       if (!idx[*idxlen])
-        idx[*idxlen] = (ATTACHPTR *) mem_calloc (1, sizeof (ATTACHPTR));
+        idx[*idxlen] = p_new(ATTACHPTR, 1);
 
       new = idx[(*idxlen)++];
       new->content = m;
@@ -550,7 +552,7 @@ void mutt_save_attachment_list (FILE * fp, int tag, BODY * top, HEADER * hdr,
       break;
   }
 
-  mem_free (&directory);
+  p_delete(&directory);
 
   if (tag && menu) {
     menu->oldcurrent = menu->current;
@@ -1241,12 +1243,12 @@ void mutt_view_attachments (HEADER * hdr)
           hdr->attach_del = 1;
         if (idx[idxmax]->content)
           idx[idxmax]->content->aptr = NULL;
-        mem_free (&idx[idxmax]->tree);
-        mem_free (&idx[idxmax]);
+        p_delete(&idx[idxmax]->tree);
+        p_delete(&idx[idxmax]);
       }
       if (hdr->attach_del)
         hdr->changed = 1;
-      mem_free (&idx);
+      p_delete(&idx);
       idxmax = 0;
 
       if (WithCrypto && need_secured && secured) {