Subject: Freeing Body parts

From: "Koos Starfield" <[email-masked]>
Date: Tue, 21 Sep 1999 09:55:06 GMT

The problem i have is that freeing with mail_free_body always generates an 
error (gpf or seg fault,..whatever).

I've included an excerpt of the code i use to send one attachment in a 
multipart message, i have an Envelope env and two bodies called :
1.head -> this is of multipart mime type body
2.body -> this is the attachment body
I use param_attachment to fill the body->parameter.
after i send with smtp_mail i want to free the envelope env, this works 
fine. Then i think i want to free the body part called head, but this goes 
wrong. But if try it with body it also goes wrong.
does anybody know a solution , or can anyone point out what is going wrong?
code is:

BODY *head = mail_newbody ();
BODY *body = mail_newbody ();
PARAMETER *param_attachment = mail_newbody_parameter();

rfc822_parse_adrlist (&env->reply_to,from, "");
rfc822_parse_adrlist (&env->return_path,from, "");

// Base64 encoding

body->encoding = ENCBINARY;
body->type = TYPEAPPLICATION ;

head->description  =  STR_MEM_ASSIGN("mail");

param_attachment->attribute = STR_MEM_ASSIGN("filename");
param_attachment->value = STR_MEM_ASSIGN(filenaam);
param_attachment->next = NULL;

body->parameter = param_attachment;

body->disposition.type = STR_MEM_ASSIGN("attachment");
body->disposition.parameter = param_attachment;

body->subtype = STR_MEM_ASSIGN(filenaam);
body->contents.text.data = (void *) text; //text is a void pointer
body->contents.text.size = size;
body->size.bytes = (int) (size / 8);

head->type = TYPEMULTIPART;
head->nested.part = mail_newbody_part();
head->nested.part->body = *body;

smtp_mail (smtp_stream,"MAIL",env, head)

mail_free_envelope (&(env));
mail_free_body (&(head));

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: "Rubinstein, Dmitry" <[email-masked]>
Date: Tue, 21 Sep 1999 15:43:41 +0300

Just off the top of my head. Do you fs_get() any strings? If so, check that
you malloc() enough space to accomodate the terminating NULL (or, rather,
terminating NIL). That is, for a string "foo" do:

foo_str = fs_get(4);

--
Dmitry Rubinstein 

> -----Original Message-----
> From: Koos Starfield [mailto:[email-masked]]
> Sent: Tuesday, September 21, 1999 11:55 AM
> To: [email-masked]
> Subject: Freeing Body parts
> 
>