diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-24 18:25:16 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-24 18:25:16 +0400 |
commit | 9727678e705943da9e44130ce485b1bdab0a8e96 (patch) | |
tree | 082bbaaed64cce1e790ace55981b36a3344c621e /src/worker.c | |
parent | bae6d9e54d8bb711144fbcf7dde1b155f471b1cd (diff) | |
download | rspamd-9727678e705943da9e44130ce485b1bdab0a8e96.tar.gz rspamd-9727678e705943da9e44130ce485b1bdab0a8e96.zip |
* Check return value of each rspamd_dispatcher_write as in case of write errors sessions can be destroyed early
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/worker.c b/src/worker.c index 5e803cc78..13880bdfa 100644 --- a/src/worker.c +++ b/src/worker.c @@ -158,7 +158,10 @@ fin_custom_filters (struct worker_task *task) if (filt->after_connect) { filt->after_connect (&output, &log, curd->data); if (output != NULL) { - rspamd_dispatcher_write (task->dispatcher, output, strlen (output), FALSE, FALSE); + if (! rspamd_dispatcher_write (task->dispatcher, output, strlen (output), FALSE, FALSE)) { + g_free (output); + return; + } g_free (output); } if (log != NULL) { @@ -190,7 +193,10 @@ parse_line_custom (struct worker_task *task, f_str_t *in) res = FALSE; } if (output != NULL) { - rspamd_dispatcher_write (task->dispatcher, output, strlen (output), FALSE, FALSE); + if (! rspamd_dispatcher_write (task->dispatcher, output, strlen (output), FALSE, FALSE)) { + g_free (output); + return FALSE; + } g_free (output); } if (curd->next) { @@ -349,7 +355,9 @@ write_socket (void *arg) switch (task->state) { case WRITE_REPLY: - write_reply (task); + if (! write_reply (task)) { + return FALSE; + } if (is_custom) { fin_custom_filters (task); } @@ -357,7 +365,9 @@ write_socket (void *arg) return FALSE; break; case WRITE_ERROR: - write_reply (task); + if (! write_reply (task)) { + return FALSE; + } if (is_custom) { fin_custom_filters (task); } |