From 7583ebb1b271e7cb8e44f8211d02bd719d4a4bd1 Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Wed, 9 Nov 2022 18:20:15 -0800 Subject: [PATCH] Make freeing a NULL redisAsyncContext a no op. This makes our behavior consistent with redisFree and freeReplyObject. --- async.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async.c b/async.c index d7feba36c..f82f567f8 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);