summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-15 16:33:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-15 16:33:15 +0100
commitbef95e1cd69b0657bf1881b9b7d4d71f381c4560 (patch)
tree09a60e36713b9e6da3dda86160cfcfdd9446c36d
parent820023550a49cc866ba7ea42d8414912f585dd34 (diff)
downloadrspamd-bef95e1cd69b0657bf1881b9b7d4d71f381c4560.tar.gz
rspamd-bef95e1cd69b0657bf1881b9b7d4d71f381c4560.zip
[Fix] Do not set bayes probability if we don't use it
-rw-r--r--src/libstat/classifiers/bayes.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index 8116e508d..af25195b0 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -356,10 +356,6 @@ bayes_classify (struct rspamd_classifier * ctx,
}
}
- pprob = rspamd_mempool_alloc (task->task_pool, sizeof (*pprob));
- *pprob = final_prob;
- rspamd_mempool_set_variable (task->task_pool, "bayes_prob", pprob, NULL);
-
if (ctx->cfg->min_tokens > 0 &&
cl.text_tokens < (gint)(ctx->cfg->min_tokens * 0.1)) {
msg_info_bayes ("ignore bayes probability %.2f since we have "
@@ -371,6 +367,10 @@ bayes_classify (struct rspamd_classifier * ctx,
return TRUE;
}
+ pprob = rspamd_mempool_alloc (task->task_pool, sizeof (*pprob));
+ *pprob = final_prob;
+ rspamd_mempool_set_variable (task->task_pool, "bayes_prob", pprob, NULL);
+
if (cl.processed_tokens > 0 && fabs (final_prob - 0.5) > 0.05) {
/* Now we can have exactly one HAM and exactly one SPAM statfiles per classifier */
for (i = 0; i < ctx->statfiles_ids->len; i++) {