Make freeing a NULL redisAsyncContext a no op.

This makes our behavior consistent with redisFree and freeReplyObject.
This commit is contained in:
michael-grunder 2022-11-09 18:20:15 -08:00 committed by Michael Grunder
parent 2c53dea7f9
commit 7583ebb1b2

View File

@ -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 * 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. */ * redisProcessCallbacks(). Otherwise, the context is immediately free'd. */
void redisAsyncFree(redisAsyncContext *ac) { void redisAsyncFree(redisAsyncContext *ac) {
if (ac == NULL)
return;
redisContext *c = &(ac->c); redisContext *c = &(ac->c);
c->flags |= REDIS_FREEING; c->flags |= REDIS_FREEING;
if (!(c->flags & REDIS_IN_CALLBACK)) if (!(c->flags & REDIS_IN_CALLBACK))
__redisAsyncFree(ac); __redisAsyncFree(ac);