]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] More guards for redis free
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Apr 2016 16:18:54 +0000 (17:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Apr 2016 16:18:54 +0000 (17:18 +0100)
src/lua/lua_redis.c

index 68e659d84d7dac42adad596f0e1f6c6bb0a6303d..1eedde277d9b1f0746087f3db8ab0f01dcf45bf1 100644 (file)
@@ -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);
+               }
        }
 }