[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.96.2.2, 1.96.2.3

cras at dovecot.org cras at dovecot.org
Mon May 29 00:55:37 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv4903

Modified Files:
      Tag: branch_1_0
	mail-index-sync-update.c 
Log Message:
Memory leak fix for last update and some other cleanups



Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.96.2.2
retrieving revision 1.96.2.3
diff -u -d -r1.96.2.2 -r1.96.2.3
--- mail-index-sync-update.c	28 May 2006 21:18:27 -0000	1.96.2.2
+++ mail-index-sync-update.c	28 May 2006 21:55:35 -0000	1.96.2.3
@@ -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);
 



More information about the dovecot-cvs mailing list