]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fixed error reported by ASAN: do not try usins already pop-ed watcher 2491/head
authorMikhail Galanin <mgalanin@mimecast.com>
Tue, 18 Sep 2018 09:20:28 +0000 (10:20 +0100)
committerMikhail Galanin <mgalanin@mimecast.com>
Tue, 18 Sep 2018 09:20:28 +0000 (10:20 +0100)
The watcher is pop-ed once session is over but reference to the structure remains in Lua and then being removed from lua dtor.
In this case we try to pop it second time. Bad.

src/lua/lua_tcp.c

index b5b6eba5f99f7baa1b351c2fabd82dad41df1c5e..91cf3726ddff2a302b71f941c8d136669695ff72 100644 (file)
@@ -485,6 +485,7 @@ lua_tcp_maybe_free (struct lua_tcp_cbdata *cbd)
                if (cbd->w) {
                        rspamd_session_watcher_pop (cbd->session, cbd->w);
                }
+               cbd->w = NULL;
 
                if (cbd->async_ev) {
                        rspamd_session_remove_event (cbd->session, lua_tcp_void_finalyser, cbd);
@@ -496,6 +497,7 @@ lua_tcp_maybe_free (struct lua_tcp_cbdata *cbd)
                if (cbd->w) {
                        rspamd_session_watcher_pop (cbd->session, cbd->w);
                }
+               cbd->w = NULL;
 
                if (cbd->async_ev) {
                        rspamd_session_remove_event (cbd->session, lua_tcp_fin, cbd);