summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/mime/mailmime_decode.c
Side-by-side diff
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
@@ -189,12 +189,22 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode,
- if (wordutf8 != NULL) {
- if (mmap_string_append(gphrase, wordutf8) == NULL) {
- free(wordutf8);
- free(raw_word);
- res = MAILIMF_ERROR_MEMORY;
- goto free;
- }
+ switch (r) {
+ case MAIL_CHARCONV_ERROR_MEMORY:
+ free(raw_word);
+ res = MAILIMF_ERROR_MEMORY;
+ goto free;
+ case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET:
+ case MAIL_CHARCONV_ERROR_CONV:
+ free(raw_word);
+ res = MAILIMF_ERROR_PARSE;
+ goto free;
+ }
+
+ if (mmap_string_append(gphrase, wordutf8) == NULL) {
free(wordutf8);
+ free(raw_word);
+ res = MAILIMF_ERROR_MEMORY;
+ goto free;
}
+
free(raw_word);