]> granicus.if.org Git - neomutt/commitdiff
Fix a memory leak.
authorThomas Glanzmann <sithglan@stud.uni-erlangen.de>
Sun, 8 Aug 2004 16:20:37 +0000 (16:20 +0000)
committerThomas Glanzmann <sithglan@stud.uni-erlangen.de>
Sun, 8 Aug 2004 16:20:37 +0000 (16:20 +0000)
ChangeLog
muttlib.c
protos.h

index 9be1bc59429dd146385078f9c6655593236d4850..b5f9b7e6460287c0abd0dffeba74d454a63557df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-08-08 16:20:37  Thomas Glanzmann  <sithglan@stud.uni-erlangen.de>  (roessler)
+
+       * muttlib.c, protos.h: Fix a memory leak.
+
 2004-08-08 16:19:15  Thomas Roessler  <roessler@does-not-exist.org>  (roessler)
 
        * pgp.c, smime.c: Fix the PGP and S/MIME menus. Complaints
index 896e9982c86561db2960f5bd95aa79a5918318ef..914d52d430343b70ceddb6a348422fdda6b2d8d2 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -638,17 +638,24 @@ void mutt_free_envelope (ENVELOPE **p)
 {
   if (!*p) return;
   rfc822_free_address (&(*p)->return_path);
+  rfc822_free_address (&(*p)->from);
   rfc822_free_address (&(*p)->to);
   rfc822_free_address (&(*p)->cc);
   rfc822_free_address (&(*p)->bcc);
   rfc822_free_address (&(*p)->sender);
-  rfc822_free_address (&(*p)->from);
   rfc822_free_address (&(*p)->reply_to);
   rfc822_free_address (&(*p)->mail_followup_to);
+
+  FREE (&(*p)->list_post);
   FREE (&(*p)->subject);
+  /* real_subj is just an offset to subject and shouldn't be freed */
   FREE (&(*p)->message_id);
   FREE (&(*p)->supersedes);
   FREE (&(*p)->date);
+  FREE (&(*p)->x_label);
+
+  mutt_free_buffer (&(*p)->spam);
+
   mutt_free_list (&(*p)->references);
   mutt_free_list (&(*p)->in_reply_to);
   mutt_free_list (&(*p)->userhdrs);
@@ -1356,6 +1363,15 @@ void mutt_buffer_addch (BUFFER* buf, char c)
   mutt_buffer_add (buf, &c, 1);
 }
 
+void mutt_free_buffer (BUFFER **p)
+{
+  if (!*p) return;
+
+   FREE(&(*p)->data);
+   /* dptr is just an offset to data and shouldn't be freed */
+   FREE(p);
+}
+
 /* dynamically grows a BUFFER to accomodate s, in increments of 128 bytes.
  * Always one byte bigger than necessary for the null terminator, and
  * the buffer is always null-terminated */
index a481e4f4b38f085695523034f8754c53ad2f79c7..821f731db748ae28e3a2538771460733d528da7d 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -38,6 +38,7 @@ void mutt_buffer_free(BUFFER **);
 void mutt_buffer_add (BUFFER*, const char*, size_t);
 void mutt_buffer_addstr (BUFFER*, const char*);
 void mutt_buffer_addch (BUFFER*, char);
+void mutt_free_buffer (BUFFER **);
 
 #define mutt_system(x) _mutt_system(x,0)
 int _mutt_system (const char *, int);