Redis Benchmark: Fix coredump because of double free

This commit is contained in:
ShooterIT 2020-05-05 23:09:45 +08:00
parent 70a80ef3ad
commit 150ba0e1ff

View File

@ -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);