[dovecot-cvs] dovecot/src/imap imap-thread.c,1.27,1.28

cras at dovecot.org cras at dovecot.org
Sun Sep 17 21:34:18 EEST 2006


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv25211/imap

Modified Files:
	imap-thread.c 
Log Message:
Memory leak fixes



Index: imap-thread.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-thread.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- imap-thread.c	17 Sep 2006 17:49:04 -0000	1.27
+++ imap-thread.c	17 Sep 2006 18:34:15 -0000	1.28
@@ -1982,11 +1982,14 @@
 static int imap_thread_mailbox_close(struct mailbox *box)
 {
 	struct imap_thread_mailbox *tbox = IMAP_THREAD_CONTEXT(box);
+	int ret;
 
 	if (tbox->msgid_hash != NULL)
 		mail_hash_free(&tbox->msgid_hash);
 
-	return tbox->super.close(box);
+	ret = tbox->super.close(box);
+	i_free(tbox);
+	return ret;
 }
 
 static void imap_thread_hash_init(struct mailbox *box, bool create)
@@ -1997,6 +2000,8 @@
 
 	i_assert(tbox->msgid_hash == NULL);
 
+	box->v.close = imap_thread_mailbox_close;
+
 	tbox->msgid_hash =
 		mail_hash_open(ibox->index, ".thread", create ?
 			       MAIL_HASH_OPEN_FLAG_CREATE : 0,
@@ -2010,7 +2015,6 @@
 	mail_index_register_expunge_handler(ibox->index, ext_id,
 					    imap_thread_expunge_handler,
 					    tbox, TRUE);
-	box->v.close = imap_thread_mailbox_close;
 }
 
 static void imap_thread_mailbox_opened(struct mailbox *box)



More information about the dovecot-cvs mailing list