fix segfault
[apps/madmutt.git] / handler.c
index 7da0547..39bc056 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -18,6 +18,8 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
 #include "ascii.h"
 #include "recvattach.h"
@@ -683,8 +685,8 @@ int text_enriched_handler (BODY * a, STATE * s)
     ((s->flags & M_DISPLAY) ? (COLS - 4) : ((COLS - 4) <
                                             72) ? (COLS - 4) : 72);
   stte.line_max = stte.WrapMargin * 4;
-  stte.line = (char *) mem_calloc (1, stte.line_max + 1);
-  stte.param = (char *) mem_calloc (1, STRING);
+  stte.line = p_new(char, stte.line_max + 1);
+  stte.param = p_new(char, STRING);
 
   stte.param_len = STRING;
   stte.param_used = 0;
@@ -775,9 +777,9 @@ int text_enriched_handler (BODY * a, STATE * s)
 
   state_putc ('\n', s);         /* add a final newline */
 
-  mem_free (&(stte.buffer));
-  mem_free (&(stte.line));
-  mem_free (&(stte.param));
+  p_delete(&(stte.buffer));
+  p_delete(&(stte.line));
+  p_delete(&(stte.param));
 
   return (0);
 }
@@ -1099,7 +1101,7 @@ static int autoview_handler (BODY * a, STATE * s)
   mutt_sanitize_filename (fname, 1);
   rfc1524_expand_filename (entry->nametemplate, fname, tempfile,
                            sizeof (tempfile));
-  mem_free (&fname);
+  p_delete(&fname);
 
   if (entry->command) {
     strfcpy (command, entry->command, sizeof (command));