summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArtix <artix2@gmail.com>2018-06-06 20:14:58 +0200
committerartix <artix2@gmail.com>2019-02-28 16:57:57 +0100
commit121adc604b4cee16fd5af15456bbb7665f37ce71 (patch)
treea98444498c2bbb9d2d4027273875d7b533c0edc8 /src
parentb013d2c4dbea97544239deebe7a8f5a19f2b5604 (diff)
downloadredis-121adc604b4cee16fd5af15456bbb7665f37ce71.tar.gz
Cluster Manager: fix memory leaks in clusterManagerGetDisconnectedLinks
Diffstat (limited to 'src')
-rw-r--r--src/redis-cli.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 9e246dce7..71c8c6b30 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -3889,7 +3889,7 @@ static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) {
(strstr(link_status, "disconnected")));
int handshaking = (strstr(flags, "handshake") != NULL);
if (disconnected || handshaking) {
- clusterManagerLink *link = malloc(sizeof(*link));
+ clusterManagerLink *link = zmalloc(sizeof(*link));
link->node_name = sdsnew(nodename);
link->node_addr = sdsnew(addr);
link->connected = 0;
@@ -3908,6 +3908,7 @@ cleanup:
static dict *clusterManagerGetLinkStatus(void) {
if (cluster_manager.nodes == NULL) return NULL;
dictType dtype = clusterManagerDictType;
+ dtype.keyDestructor = dictSdsDestructor;
dtype.valDestructor = dictListDestructor;
dict *status = dictCreate(&dtype, NULL);
listIter li;