diff options
author | artix <artix2@gmail.com> | 2018-06-06 18:45:31 +0200 |
---|---|---|
committer | artix <artix2@gmail.com> | 2019-02-28 16:57:57 +0100 |
commit | b013d2c4dbea97544239deebe7a8f5a19f2b5604 (patch) | |
tree | a18facf065e0383ad3c18664706e037f0be97bd7 /src/redis-cli.c | |
parent | 3578aabc0528e087b80e8b69378abd50b1e1633a (diff) | |
download | redis-b013d2c4dbea97544239deebe7a8f5a19f2b5604.tar.gz |
Cluster Manager: fix memory leak in clusterManagerWaitForClusterJoin
Diffstat (limited to 'src/redis-cli.c')
-rw-r--r-- | src/redis-cli.c | 9 |
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"); } |