]> granicus.if.org Git - neomutt/commitdiff
Fix memory leak when multiple x-label or supersedes header fields exist in the header.
authorMichael Elkins <me@sigpipe.org>
Thu, 3 Jan 2013 19:04:35 +0000 (19:04 +0000)
committerMichael Elkins <me@sigpipe.org>
Thu, 3 Jan 2013 19:04:35 +0000 (19:04 +0000)
In order to keep the current behavior where the value of the last header field present is the one used, free any previous value.

parse.c

diff --git a/parse.c b/parse.c
index acf0621f9d1cdd077e30c3285e0378dfd7294836..28889160269e158f213964d24b590a04f4fde6cd 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1220,7 +1220,10 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short
     }
     else if ((!ascii_strcasecmp ("upersedes", line + 1) ||
              !ascii_strcasecmp ("upercedes", line + 1)) && hdr)
+    {
+      FREE(&e->supersedes);
       e->supersedes = safe_strdup (p);
+    }
     break;
     
     case 't':
@@ -1259,6 +1262,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short
     }
     else if (ascii_strcasecmp (line+1, "-label") == 0)
     {
+      FREE(&e->x_label);
       e->x_label = safe_strdup(p);
       matched = 1;
     }