summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2022-11-09 18:20:15 -0800
committerMichael Grunder <michael.grunder@gmail.com>2022-11-09 18:35:59 -0800
commit7583ebb1b271e7cb8e44f8211d02bd719d4a4bd1 (patch)
tree5f90a7961ac6b728a6e0c25ce4f0b55c5724cd4b
parent2c53dea7f9853090c2bcbc6370e9faf958300703 (diff)
Make freeing a NULL redisAsyncContext a no op.
This makes our behavior consistent with redisFree and freeReplyObject.
-rw-r--r--async.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/async.c b/async.c
index d7feba3..f82f567 100644
--- a/async.c
+++ b/async.c
@@ -413,7 +413,11 @@ static void __redisAsyncFree(redisAsyncContext *ac) {
* free'ing. To do so, a flag is set on the context which is picked up by
* redisProcessCallbacks(). Otherwise, the context is immediately free'd. */
void redisAsyncFree(redisAsyncContext *ac) {
+ if (ac == NULL)
+ return;
+
redisContext *c = &(ac->c);
+
c->flags |= REDIS_FREEING;
if (!(c->flags & REDIS_IN_CALLBACK))
__redisAsyncFree(ac);