diff options
author | ShooterIT <wangyuancode@163.com> | 2020-05-05 23:09:45 +0800 |
---|---|---|
committer | ShooterIT <wangyuancode@163.com> | 2020-05-05 23:09:45 +0800 |
commit | 150ba0e1ff0a24d2136f893ede550d19e78a96a0 (patch) | |
tree | fbda47e8984f0b072820c936f6e88f0f5c161540 /src/redis-benchmark.c | |
parent | 70a80ef3ad5f46ed79e1336fed7b81f92edce6fb (diff) | |
download | redis-150ba0e1ff0a24d2136f893ede550d19e78a96a0.tar.gz |
Redis Benchmark: Fix coredump because of double free
Diffstat (limited to 'src/redis-benchmark.c')
-rw-r--r-- | src/redis-benchmark.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |