From 8b26fafde4f09ada6deec0a550e1bb955e6afe16 Mon Sep 17 00:00:00 2001 From: Mikhail Galanin Date: Tue, 18 Sep 2018 10:20:28 +0100 Subject: [PATCH] [Minor] Fixed error reported by ASAN: do not try usins already pop-ed watcher 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index b5b6eba5f..91cf3726d 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -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); -- 2.39.5