summaryrefslogtreecommitdiff
path: root/src/redis-cli.c
diff options
context:
space:
mode:
authorartix <artix2@gmail.com>2018-06-06 18:45:31 +0200
committerartix <artix2@gmail.com>2019-02-28 16:57:57 +0100
commitb013d2c4dbea97544239deebe7a8f5a19f2b5604 (patch)
treea18facf065e0383ad3c18664706e037f0be97bd7 /src/redis-cli.c
parent3578aabc0528e087b80e8b69378abd50b1e1633a (diff)
downloadredis-b013d2c4dbea97544239deebe7a8f5a19f2b5604.tar.gz
Cluster Manager: fix memory leak in clusterManagerWaitForClusterJoin
Diffstat (limited to 'src/redis-cli.c')
-rw-r--r--src/redis-cli.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 9ff4dfb9f..9e246dce7 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -3413,11 +3413,12 @@ static void clusterManagerWaitForClusterJoin(void) {
sleep(1);
if (++counter > check_after) {
dict *status = clusterManagerGetLinkStatus();
+ dictIterator *iter = NULL;
if (status != NULL && dictSize(status) > 0) {
printf("\n");
clusterManagerLogErr("Warning: %d node(s) may "
"be unreachable\n", dictSize(status));
- dictIterator *iter = dictGetIterator(status);
+ iter = dictGetIterator(status);
dictEntry *entry;
while ((entry = dictNext(iter)) != NULL) {
sds nodeaddr = (sds) dictGetKey(entry);
@@ -3447,11 +3448,11 @@ static void clusterManagerWaitForClusterJoin(void) {
"from standard instance port.\n");
listEmpty(from);
}
- dictReleaseIterator(iter);
- dictRelease(status);
}
+ if (iter != NULL) dictReleaseIterator(iter);
+ if (status != NULL) dictRelease(status);
counter = 0;
- }
+ }
}
printf("\n");
}