Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7432:9b8590b3749b HEAD
Don't access freed memory.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 20 Mar 2008 16:26:59 +0200 |
parents | 33d8adcc2d44 |
children | 0ee365c21c16 |
files | src/imap/imap-sync.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-sync.c Thu Mar 20 16:26:27 2008 +0200 +++ b/src/imap/imap-sync.c Thu Mar 20 16:26:59 2008 +0200 @@ -210,7 +210,7 @@ static bool cmd_sync_continue(struct client_command_context *sync_cmd) { - struct client_command_context *cmd; + struct client_command_context *cmd, *next; struct client *client = sync_cmd->client; struct imap_sync_context *ctx = sync_cmd->context; int ret; @@ -230,7 +230,9 @@ sync_cmd->context = NULL; /* finish all commands that waited for this sync */ - for (cmd = client->command_queue; cmd != NULL; cmd = cmd->next) { + for (cmd = client->command_queue; cmd != NULL; cmd = next) { + next = cmd->next; + if (cmd->state == CLIENT_COMMAND_STATE_WAIT_SYNC && cmd != sync_cmd && cmd->sync->counter+1 == client->sync_counter) {