changeset 9:8966edef462a tip

Add more uw_strdup, which seems to avoid problems from reuse of memory
author Adam Chlipala <adam@chlipala.net>
date Thu, 04 Feb 2016 17:50:25 -0500
parents fe6049d23ce5
children
files mail.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mail.c	Thu Feb 04 13:01:33 2016 -0500
+++ b/mail.c	Thu Feb 04 17:50:25 2016 -0500
@@ -61,7 +61,7 @@
  ok:
   */
   address(ctx, s);
-  h2->from = s;
+  h2->from = uw_strdup(ctx, s);
 
   return h2;
 }
@@ -79,7 +79,9 @@
     sprintf(all, "%s,%s", h2->to, s);
     h2->to = all;
   } else
-    h2->to = s;
+    h2->to = uw_strdup(ctx, s);
+
+  fprintf(stderr, "TO: %s\n", h2->to);
 
   return h2;
 }
@@ -97,7 +99,7 @@
     sprintf(all, "%s,%s", h2->cc, s);
     h2->cc = all;
   } else
-    h2->cc = s;
+    h2->cc = uw_strdup(ctx, s);
 
   return h2;
 }
@@ -115,7 +117,7 @@
     sprintf(all, "%s,%s", h2->bcc, s);
     h2->bcc = all;
   } else
-    h2->bcc = s;
+    h2->bcc = uw_strdup(ctx, s);
 
   return h2;
 }
@@ -132,7 +134,7 @@
     uw_error(ctx, FATAL, "Duplicate Subject header");
 
   header(ctx, s);
-  h2->subject = s;
+  h2->subject = uw_strdup(ctx, s);
 
   return h2;
 }