Skip to content

Commit

Permalink
Make freeing a NULL redisAsyncContext a no op.
Browse files Browse the repository at this point in the history
This makes our behavior consistent with redisFree and freeReplyObject.
  • Loading branch information
michael-grunder committed Nov 10, 2022
1 parent 2c53dea commit 7583ebb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions async.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7583ebb

Please sign in to comment.