diff options
-rw-r--r-- | src/lua/lua_redis.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 68e659d84..1eedde277 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -339,12 +339,15 @@ lua_redis_callback (redisAsyncContext *c, gpointer r, gpointer priv) } } - if (ctx->cmds_pending == 0) { + if (ctx->cmds_pending == 0 && !ud->terminated) { /* Disconnect redis early as we don't need it anymore */ ud->terminated = 1; ac = ud->ctx; ud->ctx = NULL; - redisAsyncFree (ac); + + if (ac != NULL) { + redisAsyncFree (ac); + } } } |