]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix order of operations to avoid race condition
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 10 Jun 2017 11:39:30 +0000 (12:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 10 Jun 2017 11:39:30 +0000 (12:39 +0100)
src/plugins/surbl.c

index c84cfdc88c928f9f4c45824a2e7f04d9c94ee320..286abf34c85cf43392e5efaae605e883979d3e70 100644 (file)
@@ -1801,10 +1801,7 @@ surbl_continue_process_handler (lua_State *L)
        param = (struct redirector_param *)lua_topointer (L, 2);
 
        if (param != NULL) {
-
                task = param->task;
-               rspamd_session_watcher_pop (task->s, param->w);
-               param->w = NULL;
 
                if (nurl != NULL) {
                        msg_info_surbl ("<%s> got reply from redirector: '%*s' -> '%*s'",
@@ -1841,6 +1838,9 @@ surbl_continue_process_handler (lua_State *L)
                                        param->task->message_id,
                                        param->url->urllen, param->url->string);
                }
+
+               rspamd_session_watcher_pop (task->s, param->w);
+               param->w = NULL;
        }
        else {
                return luaL_error (L, "invalid arguments");