diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 2df41580b..8e32d4f3c 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -275,7 +275,7 @@ static redisConfig *getRedisConfig(const char *ip, int port, for (; i < 2; i++) { int res = redisGetReply(c, &r); if (reply) freeReplyObject(reply); - reply = ((redisReply *) r); + reply = res == REDIS_OK ? ((redisReply *) r) : NULL; if (res != REDIS_OK || !r) goto fail; if (reply->type == REDIS_REPLY_ERROR) { fprintf(stderr, "ERROR: %s\n", reply->str);