aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-06-30 16:22:41 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-06-30 16:22:41 +0100
commit6862a6bff243d5b57fb64e8ece97f65c6cc9ac16 (patch)
tree60355047e98727b8b4b972cf682a8c79b33f15c4
parentd147f5466b3e36ae15ee18d2d4ff3a08ee5a152b (diff)
downloadrspamd-6862a6bff243d5b57fb64e8ece97f65c6cc9ac16.tar.gz
rspamd-6862a6bff243d5b57fb64e8ece97f65c6cc9ac16.zip
[Minor] Set mres earlier
Issue: #5028
-rw-r--r--src/libstat/stat_process.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index 33b7053f8..e7b6b43f0 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -974,7 +974,7 @@ rspamd_stat_check_autolearn(struct rspamd_task *task)
struct rspamd_stat_ctx *st_ctx;
struct rspamd_classifier *cl;
const ucl_object_t *obj, *elt1, *elt2;
- struct rspamd_scan_result *mres = NULL;
+ struct rspamd_scan_result *mres = task->result;
struct rspamd_task **ptask;
lua_State *L;
unsigned int i;
@@ -1005,7 +1005,6 @@ rspamd_stat_check_autolearn(struct rspamd_task *task)
* - We learn spam if action is ACTION_REJECT
* - We learn ham if score is less than zero
*/
- mres = task->result;
if (mres) {
if (mres->score > rspamd_task_get_required_score(task, mres)) {
@@ -1044,8 +1043,6 @@ rspamd_stat_check_autolearn(struct rspamd_task *task)
spam_score = t;
}
- mres = task->result;
-
if (mres) {
if (mres->score >= spam_score) {
task->flags |= RSPAMD_TASK_FLAG_LEARN_SPAM;