Make freeing a NULL redisAsyncContext a no op.
This makes our behavior consistent with redisFree and freeReplyObject.
This commit is contained in:
parent
2c53dea7f9
commit
7583ebb1b2
4
async.c
4
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
|
* 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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user