]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Set mres earlier
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 30 Jun 2024 15:22:41 +0000 (16:22 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 30 Jun 2024 15:22:41 +0000 (16:22 +0100)
Issue: #5028

src/libstat/stat_process.c

index 33b7053f86f7e5ceeafb1e72fcbb993c4a660814..e7b6b43f0eb5bb7a3e0a1c75690a85ce7d9665f1 100644 (file)
@@ -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;