summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/mime/mailmime_decode.c
Unidiff
Diffstat (limited to 'kmicromail/libetpan/mime/mailmime_decode.c') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/mime/mailmime_decode.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/kmicromail/libetpan/mime/mailmime_decode.c b/kmicromail/libetpan/mime/mailmime_decode.c
index 3025dcb..e48ec19 100644
--- a/kmicromail/libetpan/mime/mailmime_decode.c
+++ b/kmicromail/libetpan/mime/mailmime_decode.c
@@ -178,34 +178,44 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode,
178 if (mmap_string_append_c(gphrase, ' ') == NULL) { 178 if (mmap_string_append_c(gphrase, ' ') == NULL) {
179 free(raw_word); 179 free(raw_word);
180 res = MAILIMF_ERROR_MEMORY; 180 res = MAILIMF_ERROR_MEMORY;
181 goto free; 181 goto free;
182 } 182 }
183 } 183 }
184 type = TYPE_WORD; 184 type = TYPE_WORD;
185 185
186 wordutf8 = NULL; 186 wordutf8 = NULL;
187 r = charconv(tocode, default_fromcode, raw_word, 187 r = charconv(tocode, default_fromcode, raw_word,
188 strlen(raw_word), &wordutf8); 188 strlen(raw_word), &wordutf8);
189 189
190 if (wordutf8 != NULL) { 190 switch (r) {
191 if (mmap_string_append(gphrase, wordutf8) == NULL) { 191 case MAIL_CHARCONV_ERROR_MEMORY:
192 free(wordutf8); 192 free(raw_word);
193 free(raw_word); 193 res = MAILIMF_ERROR_MEMORY;
194 res = MAILIMF_ERROR_MEMORY; 194 goto free;
195 goto free;
196 }
197 195
196 case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET:
197 case MAIL_CHARCONV_ERROR_CONV:
198 free(raw_word);
199 res = MAILIMF_ERROR_PARSE;
200 goto free;
201 }
202
203 if (mmap_string_append(gphrase, wordutf8) == NULL) {
198 free(wordutf8); 204 free(wordutf8);
205 free(raw_word);
206 res = MAILIMF_ERROR_MEMORY;
207 goto free;
199 } 208 }
209
200 free(raw_word); 210 free(raw_word);
201 first = FALSE; 211 first = FALSE;
202 } 212 }
203 else if (r == MAILIMF_ERROR_PARSE) { 213 else if (r == MAILIMF_ERROR_PARSE) {
204 break; 214 break;
205 } 215 }
206 else { 216 else {
207 res = r; 217 res = r;
208 goto free; 218 goto free;
209 } 219 }
210 } 220 }
211 } 221 }