(part, pool, args, error_r);
}
+
+static void imap_bodystructure_reset_data(struct message_part *parts)
+{
+ for (; parts != NULL; parts = parts->next) {
+ parts->data = NULL;
+ imap_bodystructure_reset_data(parts->children);
+ }
+}
+
int imap_bodystructure_parse_full(const char *bodystructure,
pool_t pool, struct message_part **parts,
const char **error_r)
} T_END_PASS_STR_IF(ret < 0, error_r);
}
+ if (ret < 0) {
+ /* Don't leave partially filled data to message_parts. Some of
+ the code expects that if the first message_part->data is
+ filled, they all are. */
+ imap_bodystructure_reset_data(*parts);
+ }
+
imap_parser_unref(&parser);
i_stream_destroy(&input);
return ret;
parts = msg_parse(pool, test->message, 0, 0, FALSE);
test_assert_idx(imap_bodystructure_parse(test->bodystructure,
pool, parts, &error) == -1, i);
+ test_assert(parts->data == NULL);
test_assert_strcmp_idx(error, test->error, i);
pool_unref(&pool);
} T_END;