Prevent crash on pending replies in async code

Fixes #335.
This commit is contained in:
Jan-Erik Rediger 2015-07-27 23:35:02 +02:00
parent ded5374763
commit 36a9802c54
1 changed files with 2 additions and 1 deletions

View File

@ -418,7 +418,8 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
if (reply == NULL) {
/* When the connection is being disconnected and there are
* no more replies, this is the cue to really disconnect. */
if (c->flags & REDIS_DISCONNECTING && sdslen(c->obuf) == 0) {
if (c->flags & REDIS_DISCONNECTING && sdslen(c->obuf) == 0
&& ac->replies.head == NULL) {
__redisAsyncDisconnect(ac);
return;
}