|
Hello guys I use Pine libraries for parsing a MIME
message.
Everything is OK but I'm worried for some potential
memory leaks because this parsing is done very intensively in my
project.
Here is what I do , and how I free.Do you find
it right?
m_stream = mail_open
(NIL,(char*)m_szMailBoxName.c_str(),NIL);
//1.Open the mail box where the message is
mail_fetchstructure (m_stream,1,&body); //2.Fetch the mailstream //3.recursively I go through the MIME message and fetch every
part......
psBodyText = (unsigned char *) mail_fetchbody(m_stream,1,(char *)section,&l); //. 4 and for every part I decode
decoded = (unsigned char
*)rfc822_qprint(psBodyText,l,&newLength);
free(decoded); mail_close(m_stream);
//5.close the mailstream
I though that after 4. I must have free(psBodyText) but if I use it it
gives me an error later when I use mail_close(m_stream)
Well what do you think?Does this seem you "safe" ?
Thanks in advance,
Regards Nasko
|
