From: Timo Sirainen Date: Thu, 1 Jul 2010 17:29:06 +0000 (+0100) Subject: dsync: Potential crashfix, plus some compiler warning fixes. X-Git-Tag: 2.0.rc1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81c6044603b1c9b47e4665a68a1ffde6a0118246;p=thirdparty%2Fdovecot%2Fcore.git dsync: Potential crashfix, plus some compiler warning fixes. --HG-- branch : HEAD --- diff --git a/src/dsync/dsync-brain.c b/src/dsync/dsync-brain.c index b254b06df9..6aba69d33a 100644 --- a/src/dsync/dsync-brain.c +++ b/src/dsync/dsync-brain.c @@ -289,10 +289,11 @@ dsync_brain_mailbox_action(struct dsync_brain *brain, static void dsync_brain_sync_mailboxes(struct dsync_brain *brain) { - struct dsync_mailbox *const *src_boxes, *const *dest_boxes, *action_box; + struct dsync_mailbox *const *src_boxes, *const *dest_boxes; + struct dsync_mailbox *action_box = NULL; + struct dsync_worker *action_worker = NULL; unsigned int src, dest, src_count, dest_count; enum dsync_brain_mailbox_action action; - struct dsync_worker *action_worker; bool src_deleted, dest_deleted; int ret; @@ -369,7 +370,7 @@ static void dsync_brain_sync_dirs(struct dsync_brain *brain) struct dsync_mailbox *const *src_boxes, *const *dest_boxes, *action_box; unsigned int src, dest, src_count, dest_count; enum dsync_brain_mailbox_action action; - struct dsync_worker *action_worker; + struct dsync_worker *action_worker = NULL; bool src_deleted, dest_deleted; int ret; @@ -378,6 +379,8 @@ static void dsync_brain_sync_dirs(struct dsync_brain *brain) dest_boxes = array_get(&brain->dest_mailbox_list->dirs, &dest_count); for (src = dest = 0; src < src_count && dest < dest_count; ) { action = DSYNC_BRAIN_MAILBOX_ACTION_NONE; + action_box = NULL; + src_deleted = (src_boxes[src]->flags & DSYNC_MAILBOX_FLAG_DELETED_DIR) != 0; dest_deleted = (dest_boxes[dest]->flags & @@ -418,7 +421,8 @@ static void dsync_brain_sync_dirs(struct dsync_brain *brain) } else { src++; dest++; } - i_assert(dsync_mailbox_is_noselect(action_box)); + i_assert(action_box == NULL || + dsync_mailbox_is_noselect(action_box)); dsync_brain_mailbox_action(brain, action, action_worker, action_box); }