# HG changeset patch # User Timo Sirainen # Date 1120426518 -10800 # Node ID 7e39590da48a777c44df328470b7e80fdc6e1ea5 # Parent 3e1d7dffb3a2062fa24ace8199150b5e0618c059 Call t_push/t_pop around client command execution function, so if client sends multiple commands at once we don't waste memory. diff -r 3e1d7dffb3a2 -r 7e39590da48a src/imap/client.c --- a/src/imap/client.c Mon Jul 04 00:19:44 2005 +0300 +++ b/src/imap/client.c Mon Jul 04 00:35:18 2005 +0300 @@ -352,6 +352,7 @@ { struct client *client = context; struct client_command_context *cmd = &client->cmd; + int ret; if (client->command_pending) { /* already processing one command. wait. */ @@ -380,8 +381,11 @@ } o_stream_cork(client->output); - while (client_handle_input(cmd)) - ; + do { + t_push(); + ret = client_handle_input(cmd); + t_pop(); + } while (ret); o_stream_uncork(client->output); if (client->command_pending) diff -r 3e1d7dffb3a2 -r 7e39590da48a src/pop3/client.c --- a/src/pop3/client.c Mon Jul 04 00:19:44 2005 +0300 +++ b/src/pop3/client.c Mon Jul 04 00:35:18 2005 +0300 @@ -317,6 +317,7 @@ { struct client *client = context; char *line, *args; + int ret; if (client->cmd != NULL) { /* we're still processing a command. wait until it's @@ -351,7 +352,10 @@ else *args++ = '\0'; - if (client_command_execute(client, line, args) >= 0) { + t_push(); + ret = client_command_execute(client, line, args); + t_pop(); + if (ret >= 0) { client->bad_counter = 0; if (client->cmd != NULL) { o_stream_set_flush_pending(client->output,