diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-29 17:18:54 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-29 17:18:54 +0100 |
commit | 0591ed1478b66a9bf1eac411094218069d9043e4 (patch) | |
tree | 7fb1c9339a3f8775073113895106e89dd8c6b656 /src/lua/lua_redis.c | |
parent | bb58ea6af4f6820e7d534eaf858d4933a72790ae (diff) | |
download | rspamd-0591ed1478b66a9bf1eac411094218069d9043e4.tar.gz rspamd-0591ed1478b66a9bf1eac411094218069d9043e4.zip |
[Fix] More guards for redis free
Diffstat (limited to 'src/lua/lua_redis.c')
-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); + } } } |