diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-utils.c | 11 |
2 files changed, 19 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 2cf45257d5..051531b8c7 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,14 @@ 2003-04-09 Jeffrey Stedfast <fejj@ximian.com> + * providers/imap/camel-imap-utils.c (imap_body_decode): Save the + content size in a temp variable until after we've successfully + parsed all of the body_type_1part expr. Also fixed a type-o in the + body_type_mpart case that caused the parser to fail. + (imap_parse_body): On failure to parse the body, as we iterate + through the child nodes, set their children/parent/next nodes to + NULL so that content_info_free() won't double-free any of the + other nodes we have already free'd (or are about to free). + * camel-gpg-context.c (gpg_ctx_get_utf8_diagnostics): New function to get the UTF-8 version of the diagnostics (if the locale isn't already UTF-8 safe). diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c index 6ca3b5d84a..59977e2e69 100644 --- a/camel/providers/imap/camel-imap-utils.c +++ b/camel/providers/imap/camel-imap-utils.c @@ -776,6 +776,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol char *description = NULL; char *encoding = NULL; unsigned int len; + size_t size; char *p; if (*inptr++ != '(') @@ -900,7 +901,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol goto exception; /* size */ - ci->size = strtoul ((const char *) inptr, &p, 10); + size = strtoul ((const char *) inptr, &p, 10); inptr = (const unsigned char *) p; if (header_content_type_is (ctype, "message", "rfc822")) { @@ -943,6 +944,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol ci->id = id; ci->description = description; ci->encoding = encoding; + ci->size = size; ci->childs = child; } @@ -990,6 +992,13 @@ imap_parse_body (const char **body_p, CamelFolder *folder, if (!(imap_body_decode (&inptr, ci, folder, children))) { for (i = 0; i < children->len; i++) { child = children->pdata[i]; + + /* content_info_free will free all the child + * nodes, but we don't want that. */ + child->next = NULL; + child->parent = NULL; + child->childs = NULL; + camel_folder_summary_content_info_free (folder->summary, child); } *body_p = NULL; |