]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] cbref is initilised with -1 by default 2449/head
authorMikhail Galanin <mgalanin@mimecast.com>
Thu, 30 Aug 2018 09:54:16 +0000 (10:54 +0100)
committerMikhail Galanin <mgalanin@mimecast.com>
Thu, 30 Aug 2018 09:54:16 +0000 (10:54 +0100)
src/lua/lua_tcp.c

index 61a73acf856d62bfd2a45d70cabd40bed81ba5d9..ce91d78735cc03fdbfb71f54698cdca0702aef49 100644 (file)
@@ -249,7 +249,7 @@ lua_tcp_shift_handler (struct lua_tcp_cbdata *cbd)
        }
 
        if (hdl->type == LUA_WANT_READ) {
-               if (hdl->h.r.cbref) {
+               if (hdl->h.r.cbref && hdl->h.r.cbref != -1) {
                        luaL_unref (cbd->task->cfg->lua_state, LUA_REGISTRYINDEX, hdl->h.r.cbref);
                }
 
@@ -258,7 +258,7 @@ lua_tcp_shift_handler (struct lua_tcp_cbdata *cbd)
                }
        }
        else {
-               if (hdl->h.w.cbref) {
+               if (hdl->h.w.cbref && hdl->h.w.cbref != -1) {
                        luaL_unref (cbd->task->cfg->lua_state, LUA_REGISTRYINDEX, hdl->h.w.cbref);
                }