changeset 4284:ae0d876d98f5 HEAD

Memory leak fix for last update and some other cleanups
author Timo Sirainen <tss@iki.fi>
date Tue, 30 May 2006 11:36:43 +0300
parents 22b54c007b91
children 9f5cdfb282a0
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Tue May 30 11:36:11 2006 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Tue May 30 11:36:43 2006 +0300
@@ -17,18 +17,22 @@
 {
         struct mail_index_view *view = ctx->view;
 
+	i_assert(view->map != map);
+
 	/* if map still exists after this, it's only in views. */
 	view->map->write_to_disk = FALSE;
 
 	mail_index_unmap(view->index, &view->map);
 	view->map = map;
-	view->map->refcount++;
 
 	if ((ctx->type & (MAIL_INDEX_SYNC_HANDLER_FILE |
 			  MAIL_INDEX_SYNC_HANDLER_HEAD)) != 0) {
+		i_assert(view->index->map != map);
+
 		mail_index_unmap(view->index, &view->index->map);
 		view->index->map = map;
 		view->index->hdr = &map->hdr;
+		map->refcount++;
 
 		if (ctx->type == MAIL_INDEX_SYNC_HANDLER_FILE) {
 			map->write_to_disk = TRUE;
@@ -770,6 +774,8 @@
 	map->hdr.log_file_seq = seq;
 	map->hdr.log_file_ext_offset = offset;
 
+	i_assert(map->hdr_copy_buf->used <= map->hdr.header_size);
+
 	if (first_append_uid != 0)
 		mail_index_update_day_headers(&map->hdr, first_append_uid);