aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_tcp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-30 20:05:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-30 20:05:36 +0000
commit82e915649d2f4aa62a1382430c029c53abd066b1 (patch)
tree0d66fa653abb28292f5d616bf219192942e57e7a /src/lua/lua_tcp.c
parent29970580438f9a8baa9bb76231bb0537a73974e3 (diff)
downloadrspamd-82e915649d2f4aa62a1382430c029c53abd066b1.tar.gz
rspamd-82e915649d2f4aa62a1382430c029c53abd066b1.zip
[Minor] Lua_tcp: Do not decrease item refcount with no watcher
Diffstat (limited to 'src/lua/lua_tcp.c')
-rw-r--r--src/lua/lua_tcp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index 09d572199..1edd7127e 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -1768,6 +1768,7 @@ lua_tcp_request (lua_State *L)
if (rspamd_session_blocked (session)) {
lua_tcp_push_error (cbd, TRUE, "async session is the blocked state");
TCP_RELEASE (cbd);
+ cbd->item = NULL; /* To avoid decrease with no watcher */
lua_pushboolean (L, FALSE);
return 1;
@@ -1784,6 +1785,7 @@ lua_tcp_request (lua_State *L)
lua_tcp_push_error (cbd, TRUE, "cannot connect to the host: %s", host);
lua_pushboolean (L, FALSE);
+ /* No reset of the item as watcher has been registered */
TCP_RELEASE (cbd);
return 1;
@@ -1795,7 +1797,7 @@ lua_tcp_request (lua_State *L)
RDNS_REQUEST_A, host)) {
lua_tcp_push_error (cbd, TRUE, "cannot resolve host: %s", host);
lua_pushboolean (L, FALSE);
-
+ cbd->item = NULL; /* To avoid decrease with no watcher */
TCP_RELEASE (cbd);
return 1;
@@ -1809,6 +1811,7 @@ lua_tcp_request (lua_State *L)
RDNS_REQUEST_A, host)) {
lua_tcp_push_error (cbd, TRUE, "cannot resolve host: %s", host);
lua_pushboolean (L, FALSE);
+ cbd->item = NULL; /* To avoid decrease with no watcher */
TCP_RELEASE (cbd);