summaryrefslogtreecommitdiff
path: root/src/redis-benchmark.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-05-08 10:53:20 +0200
committerGitHub <noreply@github.com>2020-05-08 10:53:20 +0200
commit5fa6f9ebe12c439b56c17ac49db1796516fe5319 (patch)
treeb162032f16048e386d21287108d26a22b37c900f /src/redis-benchmark.c
parente17f9311c8ee18996e4b932a1284e4cfe29c05b4 (diff)
parent150ba0e1ff0a24d2136f893ede550d19e78a96a0 (diff)
downloadredis-5fa6f9ebe12c439b56c17ac49db1796516fe5319.tar.gz
Merge pull request #7204 from ShooterIT/benchmark-fix
Redis Benchmark: Fix coredump because of double free
Diffstat (limited to 'src/redis-benchmark.c')
-rw-r--r--src/redis-benchmark.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 77daf981c..34295147d 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -279,7 +279,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);