dovecot-1.2: virtual: Crashfixes.

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 9 01:17:07 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/e5633843c336
changeset: 8931:e5633843c336
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 08 18:17:02 2009 -0400
description:
virtual: Crashfixes.

diffstat:

1 file changed, 7 insertions(+), 3 deletions(-)
src/plugins/virtual/virtual-mail.c |   10 +++++++---

diffs (40 lines):

diff -r a876b1fafa88 -r e5633843c336 src/plugins/virtual/virtual-mail.c
--- a/src/plugins/virtual/virtual-mail.c	Wed Apr 08 13:46:38 2009 -0400
+++ b/src/plugins/virtual/virtual-mail.c	Wed Apr 08 18:17:02 2009 -0400
@@ -42,7 +42,10 @@ virtual_mail_alloc(struct mailbox_transa
 	vmail->imail.trans = (struct index_transaction_context *)t;
 
 	vmail->wanted_fields = wanted_fields;
-	vmail->wanted_headers = wanted_headers;
+	if (wanted_headers != NULL) {
+		vmail->wanted_headers = wanted_headers;
+		mailbox_header_lookup_ref(wanted_headers);
+	}
 	i_array_init(&vmail->backend_mails, array_count(&mbox->backend_boxes));
 	return &vmail->imail.mail.mail;
 }
@@ -58,6 +61,8 @@ static void virtual_mail_free(struct mai
 		mail_free(&mails[i]);
 	array_free(&vmail->backend_mails);
 
+	if (vmail->wanted_headers != NULL)
+		mailbox_header_lookup_unref(&vmail->wanted_headers);
 	pool_unref(&vmail->imail.data_pool);
 	pool_unref(&vmail->imail.mail.pool);
 }
@@ -130,14 +135,13 @@ static void virtual_mail_set_seq(struct 
 
 static bool virtual_mail_set_uid(struct mail *mail, uint32_t uid)
 {
-	struct virtual_mail *vmail = (struct virtual_mail *)mail;
 	struct virtual_mailbox *mbox = (struct virtual_mailbox *)mail->box;
 	uint32_t seq;
 
 	if (!mail_index_lookup_seq(mbox->ibox.view, uid, &seq))
 		return FALSE;
 
-	virtual_mail_set_seq(vmail->backend_mail, seq);
+	virtual_mail_set_seq(mail, seq);
 	return TRUE;
 }
 


More information about the dovecot-cvs mailing list