changeset 2912:e491b5d1a73a HEAD

We were accessing map which was potentially already freed.
author Timo Sirainen <tss@iki.fi>
date Mon, 29 Nov 2004 03:15:49 +0200
parents f2c2b17d7659
children cd293e5e6a71
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Mon Nov 29 02:48:45 2004 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Mon Nov 29 03:15:49 2004 +0200
@@ -1113,7 +1113,7 @@
 			mail_transaction_log_view_get_prev_pos(view->log_view,
 							       &prev_seq,
 							       &prev_offset);
-			if (prev_offset < map->hdr.log_file_ext_offset) {
+			if (prev_offset < view->map->hdr.log_file_ext_offset) {
 				/* we have already synced this change */
 				continue;
 			}
@@ -1144,6 +1144,10 @@
 			ret = -1;
 			break;
 		}
+
+		/* mail_index_sync_record() might have changed map to anything.
+		   make sure we don't accidentally try to use it. */
+		map = NULL;
 	}
 	map = view->map;
         mail_index_sync_map_deinit(&sync_map_ctx);