changeset 4418:fa7ae95c125b HEAD

Crashfix if mail's data is fetched in specific order (I'm not sure how to reproduce this though, but the crash has happened to others)
author Timo Sirainen <tss@iki.fi>
date Sat, 17 Jun 2006 23:15:10 +0300
parents 1eda19d6f1a7
children c38157eefd1e
files src/lib-storage/index/index-mail-headers.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail-headers.c	Sat Jun 17 23:03:18 2006 +0300
+++ b/src/lib-storage/index/index-mail-headers.c	Sat Jun 17 23:15:10 2006 +0300
@@ -352,9 +352,12 @@
 
 	index_mail_parse_header_init(mail, headers);
 
-	if (data->parts == NULL && data->parser_ctx == NULL) {
+	if (data->parser_ctx == NULL && (data->parts == NULL ||
+					 data->save_bodystructure_header)) {
 		/* initialize bodystructure parsing in case we read the whole
 		   message. */
+		if (data->parser_ctx != NULL)
+			(void)message_parser_deinit(&mail->data.parser_ctx);
 		data->parser_ctx =
 			message_parser_init(mail->data_pool, data->stream);
 		message_parser_parse_header(data->parser_ctx, &data->hdr_size,