# HG changeset patch # User Timo Sirainen # Date 1112108799 -10800 # Node ID 3957eece913f2b5597a06114fdd22e15c3a9025d # Parent 6491dab63e545d1eca1a971df212d7f40467e952 Don't crash when closing streamed mbox. diff -r 6491dab63e54 -r 3957eece913f src/lib-storage/index/mbox/mbox-storage.c --- a/src/lib-storage/index/mbox/mbox-storage.c Tue Mar 29 16:33:07 2005 +0300 +++ b/src/lib-storage/index/mbox/mbox-storage.c Tue Mar 29 18:06:39 2005 +0300 @@ -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; }