changeset 12315:5f9919f9e321

pop3: Don't crash if client disconnects in output handler.
author Timo Sirainen <tss@iki.fi>
date Tue, 19 Oct 2010 20:20:18 +0100
parents f7f2edaf6dca
children f170b3e39a34
files src/pop3/pop3-client.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/pop3/pop3-client.c	Tue Oct 19 19:27:59 2010 +0100
+++ b/src/pop3/pop3-client.c	Tue Oct 19 20:20:18 2010 +0100
@@ -662,8 +662,12 @@
 			client->io = io_add(i_stream_get_fd(client->input),
 					    IO_READ, client_input, client);
 		}
-		if (client->io != NULL && client->waiting_input)
-			client_input(client);
+		if (client->io != NULL && client->waiting_input) {
+			if (!client_handle_input(client)) {
+				/* client got destroyed */
+				return 1;
+			}
+		}
 	}
 
 	o_stream_uncork(client->output);