aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-05 09:27:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-05 09:27:20 +0100
commit5eab8882c846be792f3dbba9d87ce9ecbc136122 (patch)
treee7b4082c5204d36100c0cc201cedb8e8456cfe06 /src
parent28a09301501c01c5eb9ef6d20d1346200a2c5dce (diff)
downloadrspamd-5eab8882c846be792f3dbba9d87ce9ecbc136122.tar.gz
rspamd-5eab8882c846be792f3dbba9d87ce9ecbc136122.zip
[Fix] Try to fix redis crashes
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_redis.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 2e19cc4d4..235409667 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -319,6 +319,7 @@ lua_redis_callback (redisAsyncContext *c, gpointer r, gpointer priv)
return;
}
+ REF_RETAIN (ctx);
event_del (&sp_ud->timeout);
ctx->cmds_pending --;
@@ -354,6 +355,8 @@ lua_redis_callback (redisAsyncContext *c, gpointer r, gpointer priv)
redisAsyncFree (ac);
}
}
+
+ REF_RELEASE (ctx);
}
static void
@@ -364,6 +367,8 @@ lua_redis_timeout (int fd, short what, gpointer u)
redisAsyncContext *ac;
ctx = sp_ud->ctx;
+
+ REF_RETAIN (ctx);
msg_info ("timeout while querying redis server");
lua_redis_push_error ("timeout while connecting the server", ctx, sp_ud, FALSE);
@@ -375,8 +380,10 @@ lua_redis_timeout (int fd, short what, gpointer u)
* This will call all callbacks pending so the entire context
* will be destructed
*/
+ sp_ud->c->terminated = 1;
redisAsyncFree (ac);
}
+ REF_RELEASE (ctx);
}