From 6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 27 Mar 2003 20:16:57 +0000 Subject: When we remove a node from the list, make sure to g_list_free_1(). 2003-03-27 Jeffrey Stedfast * camel-mime-utils.c (header_encode_phrase_merge_words): When we remove a node from the list, make sure to g_list_free_1(). (header_encode_phrase_merge_words): Don't use CAMEL_FOLD_PREENCODED as the upper-bound for merged-word length if the merged-word will not be an rfc2047 encoded word. Instead, use CAMEL_FOLD_SIZE-8 (which is the value we use in other places for determining upper-bound lengths). Solves bug #38659. svn path=/trunk/; revision=20549 --- camel/camel-mime-utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'camel/camel-mime-utils.c') diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 04fa0e6f90..6ba498ffa9 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -1561,6 +1561,8 @@ header_encode_phrase_get_words (const unsigned char *in) return words; } +#define MERGED_WORD_LT_FOLDLEN(wordlen, type) ((type) == WORD_2047 ? (wordlen) < CAMEL_FOLD_PREENCODED : (wordlen) < (CAMEL_FOLD_SIZE - 8)) + static gboolean header_encode_phrase_merge_words (GList **wordsp) { @@ -1578,13 +1580,15 @@ header_encode_phrase_merge_words (GList **wordsp) next = nextl->data; /* merge nodes of the same type AND we are not creating too long a string */ if (word_types_compatable (word->type, next->type)) { - if (next->end - word->start < CAMEL_FOLD_PREENCODED) { + if (MERGED_WORD_LT_FOLDLEN (next->end - word->start, MAX (word->type, next->type))) { /* the resulting word type is the MAX of the 2 types */ word->type = MAX(word->type, next->type); word->end = next->end; words = g_list_remove_link (words, nextl); + g_list_free_1 (nextl); g_free (next); + nextl = g_list_next (wordl); merged = TRUE; -- cgit v1.2.3