[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c, 1.113, 1.114

cras at dovecot.org cras at dovecot.org
Tue Mar 29 18:06:42 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv32265/lib-storage/index/mbox

Modified Files:
	mbox-storage.c 
Log Message:
Don't crash when closing streamed mbox.



Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- mbox-storage.c	29 Mar 2005 13:33:08 -0000	1.113
+++ mbox-storage.c	29 Mar 2005 15:06:39 -0000	1.114
@@ -940,6 +940,7 @@
 {
 	struct index_mailbox *ibox = (struct index_mailbox *)box;
 	const struct mail_index_header *hdr;
+	struct mail_index *free_index = NULL;
 	int ret = 0;
 
 	hdr = mail_index_get_header(ibox->view);
@@ -954,9 +955,16 @@
         mbox_file_close(ibox);
 	if (ibox->mbox_file_stream != NULL) {
 		i_stream_unref(ibox->mbox_file_stream);
-                ibox->mbox_file_stream = NULL;
+		ibox->mbox_file_stream = NULL;
+
+		/* it's not in storage's index cache, so free it manually */
+		free_index = ibox->index;
+		ibox->index = NULL;
 	}
+
 	index_storage_mailbox_free(box);
+	if (free_index != NULL)
+		mail_index_free(free_index);
 	return ret;
 }
 



More information about the dovecot-cvs mailing list