diff --git a/src/pool.c b/src/pool.c index 4836d27..741c7da 100644 --- a/src/pool.c +++ b/src/pool.c @@ -96,6 +96,11 @@ pool_on_disconnect(const redisAsyncContext *ac, int status) { struct pool *p = ac->data; int i = 0; + + if(p == NULL) { /* no need to clean anything here. */ + return; + } + if (status != REDIS_OK) { char format[] = "Error disconnecting: %s"; size_t msg_sz = sizeof(format) - 2 + ((ac && ac->errstr) ? strlen(ac->errstr) : 6); @@ -107,10 +112,6 @@ pool_on_disconnect(const redisAsyncContext *ac, int status) { } } - if(p == NULL) { /* no need to clean anything here. */ - return; - } - /* remove from the pool */ for(i = 0; i < p->count; ++i) { if(p->ac[i] == ac) {