From 5eab8882c846be792f3dbba9d87ce9ecbc136122 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 5 May 2016 09:27:20 +0100 Subject: [PATCH] [Fix] Try to fix redis crashes --- src/lua/lua_redis.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); } -- 2.39.5