Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8891:fbb2343b85d9 HEAD
imap/pop3-login: Don't crash when shutting down and destroying clients.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 02 Apr 2009 14:25:27 -0400 |
parents | 697f380acfbb |
children | 66a8cbe7f007 |
files | src/imap-login/client.c src/pop3-login/client.c |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap-login/client.c Thu Apr 02 14:10:16 2009 -0400 +++ b/src/imap-login/client.c Thu Apr 02 14:25:27 2009 -0400 @@ -687,11 +687,12 @@ void clients_destroy_all(void) { - struct client *client; + struct client *client, *next; - for (client = clients; client != NULL; client = client->next) { + for (client = clients; client != NULL; client = next) { struct imap_client *imap_client = (struct imap_client *)client; + next = client->next; client_destroy(imap_client, "Disconnected: Shutting down"); } }
--- a/src/pop3-login/client.c Thu Apr 02 14:10:16 2009 -0400 +++ b/src/pop3-login/client.c Thu Apr 02 14:25:27 2009 -0400 @@ -479,11 +479,12 @@ void clients_destroy_all(void) { - struct client *client; + struct client *client, *next; - for (client = clients; client != NULL; client = client->next) { + for (client = clients; client != NULL; client = next) { struct pop3_client *pop3_client = (struct pop3_client *)client; + next = client->next; client_destroy(pop3_client, "Disconnected: Shutting down"); } }