Skip to content

Commit

Permalink
Merge pull request redis#5579 from yongman/fix-rediscli-pointer-access
Browse files Browse the repository at this point in the history
Fix pointer access and memory leak in redis-cli.
  • Loading branch information
antirez authored Nov 20, 2018
2 parents 30a455f + 6432490 commit 8acc07e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/redis-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,7 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
if (err != NULL) {
*err = zmalloc((reply->len + 1) * sizeof(char));
strcpy(*err, reply->str);
CLUSTER_MANAGER_PRINT_REPLY_ERROR(source, err);
CLUSTER_MANAGER_PRINT_REPLY_ERROR(source, *err);
}
goto next;
}
Expand Down Expand Up @@ -2947,7 +2947,7 @@ static int clusterManagerMoveSlot(clusterManagerNode *source,
if (err != NULL) {
*err = zmalloc((r->len + 1) * sizeof(char));
strcpy(*err, r->str);
CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, err);
CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, *err);
}
}
freeReplyObject(r);
Expand Down Expand Up @@ -5196,10 +5196,13 @@ static int clusterManagerCommandSetTimeout(int argc, char **argv) {
n->port);
ok_count++;
continue;
reply_err:
reply_err:;
int need_free = 0;
if (err == NULL) err = "";
else need_free = 1;
clusterManagerLogErr("ERR setting node-timeot for %s:%d: %s\n", n->ip,
n->port, err);
if (need_free) zfree(err);
err_count++;
}
clusterManagerLogInfo(">>> New node timeout set. %d OK, %d ERR.\n",
Expand Down

0 comments on commit 8acc07e

Please sign in to comment.