From 0591ed1478b66a9bf1eac411094218069d9043e4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 29 Apr 2016 17:18:54 +0100 Subject: [Fix] More guards for redis free --- src/lua/lua_redis.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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); + } } } -- cgit v1.2.3