aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-04-10 05:02:34 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-04-10 05:02:34 +0800
commit94286866e7f748254b0f3ec70e4a52b729bc4dd0 (patch)
tree509a1392fbff4f8160005662cc5449f234ab2513
parentb1a244dcb1f7d42cd018d4e62bd14a314490ac6c (diff)
downloadgsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.tar
gsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.tar.gz
gsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.tar.bz2
gsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.tar.lz
gsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.tar.xz
gsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.tar.zst
gsoc2013-evolution-94286866e7f748254b0f3ec70e4a52b729bc4dd0.zip
Save the content size in a temp variable until after we've successfully
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). svn path=/trunk/; revision=20795
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/providers/imap/camel-imap-utils.c11
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;