summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-04-14 18:23:42 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-04-14 18:23:42 +0300
commitdbbf8dae0bdd56d108f8bfda7614b4a3b895eae2 (patch)
tree75e2168e73ebb642bde137dfac1092a9c0b6483b /examples
parent77b116b12786c1f9520e87868528494db61ce8af (diff)
downloadmailutils-dbbf8dae0bdd56d108f8bfda7614b4a3b895eae2.tar.gz
mailutils-dbbf8dae0bdd56d108f8bfda7614b4a3b895eae2.tar.bz2
Fix memory leaks in filter and filter_iconv code.
* mailbox/filter.c (filter_destroy): Destroy the underlying stream, unless flag is given. (mu_filter_create): Treat last argument as stream flags. * mailbox/filter_iconv.c (_icvt_destroy): Free the icvt_stream structure. * examples/mimetest.c (message_display_parts): Pass MU_STREAM_NO_CLOSE to the invocation of mu_filter_create. * mail/decode.c (display_submessage): Likewise. * mailbox/attachment.c (mu_message_save_attachment): Likewise. * mh/mh_list.c (eval_body): Likewise. * mh/mhn.c (mhn_message_size, show_internal): Likewise. (finish_text_msg): Likewise; call mu_stream_destroy * imap4d/preauth.c (decode64_buf): remove unnecessary call to mu_stream_destroy. * libmu_auth/ldap.c (chk_md5, chk_smd5) (chk_sha, chk_ssha): Likewise. * mailbox/mutil.c: Fix indentation.
Diffstat (limited to 'examples')
-rw-r--r--examples/mimetest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/mimetest.c b/examples/mimetest.c
index bca97af28..923e4d0ff 100644
--- a/examples/mimetest.c
+++ b/examples/mimetest.c
@@ -251,7 +251,10 @@ message_display_parts (mu_message_t msg, int indent)
printf ("%*.*sBegin\n", indent, indent, "");
mu_message_get_body (part, &body);
mu_body_get_stream (body, &str);
- mu_filter_create (&str, str, encoding, 0, 0);
+ /* Make sure the original body stream is not closed when
+ str gets destroyed */
+ mu_filter_create (&str, str, encoding, MU_FILTER_DECODE,
+ MU_STREAM_READ | MU_STREAM_NO_CLOSE);
offset = 0;
while (mu_stream_readline (str, buf, sizeof (buf),
offset, &nbytes) == 0 && nbytes)

Return to:

Send suggestions and report system problems to the System administrator.