]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap/pop3-login: Don't crash when shutting down and destroying clients.
authorTimo Sirainen <tss@iki.fi>
Thu, 2 Apr 2009 18:25:27 +0000 (14:25 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 2 Apr 2009 18:25:27 +0000 (14:25 -0400)
--HG--
branch : HEAD

src/imap-login/client.c
src/pop3-login/client.c

index 3e8a1e8adc38d1b173e8c82d5e06a599cafcfcd6..6e96f98271b7609b305d163d928a8e8e081dc06d 100644 (file)
@@ -687,11 +687,12 @@ void clients_notify_auth_connected(void)
 
 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");
        }
 }
index 076e9bc465d6807a12115f2cf29e8c8c40b5ff93..7c049586b13ae2c282f854154a8d5b4fa672a597 100644 (file)
@@ -479,11 +479,12 @@ void clients_notify_auth_connected(void)
 
 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");
        }
 }