aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-16 22:16:19 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-16 22:16:19 +0000
commit9f9354400bef0a810d3b1117e08c8149dfcb8489 (patch)
treee7dbf1547d5c5bab2ccf4e493d2d301771dd9486 /src/libserver
parent1deaf3b4e9e49ef4cb20dbcb05b2e749cb6168cc (diff)
downloadrspamd-9f9354400bef0a810d3b1117e08c8149dfcb8489.tar.gz
rspamd-9f9354400bef0a810d3b1117e08c8149dfcb8489.zip
Fix memory leak
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/task.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 657fcdc11..c61217921 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -464,16 +464,19 @@ rspamd_task_process (struct rspamd_task *task, guint stages)
case RSPAMD_TASK_STAGE_LEARN_PRE:
case RSPAMD_TASK_STAGE_LEARN_POST:
if (task->flags & (RSPAMD_TASK_FLAG_LEARN_SPAM|RSPAMD_TASK_FLAG_LEARN_HAM)) {
- if (!rspamd_stat_learn (task,
- task->flags & RSPAMD_TASK_FLAG_LEARN_SPAM,
- task->cfg->lua_state, task->classifier,
- st, &stat_error)) {
+ if (task->err == NULL) {
+ if (!rspamd_stat_learn (task,
+ task->flags & RSPAMD_TASK_FLAG_LEARN_SPAM,
+ task->cfg->lua_state, task->classifier,
+ st, &stat_error)) {
+
+ if (!(task->flags & RSPAMD_TASK_FLAG_LEARN_AUTO)) {
+ task->err = stat_error;
+ }
- if (!(task->flags & RSPAMD_TASK_FLAG_LEARN_AUTO)) {
- task->err = stat_error;
+ msg_err_task ("learn error: %e", stat_error);
+ task->processed_stages |= RSPAMD_TASK_STAGE_DONE;
}
- msg_err_task ("learn error: %e", stat_error);
- task->processed_stages |= RSPAMD_TASK_STAGE_DONE;
}
}
break;