]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] One more fix in redis destructor
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 3 May 2016 12:16:30 +0000 (13:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 3 May 2016 12:16:30 +0000 (13:16 +0100)
src/lua/lua_redis.c

index 1eedde277d9b1f0746087f3db8ab0f01dcf45bf1..55a85d22d9b9c6ab5df79997538bdc4e1674d53c 100644 (file)
@@ -135,6 +135,7 @@ lua_redis_dtor (struct lua_redis_ctx *ctx)
 {
        struct lua_redis_userdata *ud;
        struct lua_redis_specific_userdata *cur, *tmp;
+       gboolean is_connected = FALSE;
 
        if (ctx->async) {
                ud = &ctx->d.async;
@@ -149,10 +150,14 @@ lua_redis_dtor (struct lua_redis_ctx *ctx)
                        ctx->ref.refcount = 100500;
                        redisAsyncFree (ud->ctx);
                        ctx->ref.refcount = 0;
+                       is_connected = TRUE;
                }
                LL_FOREACH_SAFE (ud->specific, cur, tmp) {
                        lua_redis_free_args (cur->args, cur->nargs);
-                       event_del (&cur->timeout);
+
+                       if (is_connected) {
+                               event_del (&cur->timeout);
+                       }
 
                        if (cur->cbref != -1) {
                                luaL_unref (ud->L, LUA_REGISTRYINDEX, cur->cbref);