From c90cf3d82f3288762441f2c287a21301c8be0ae7 Mon Sep 17 00:00:00 2001 From: Zhicheng Wei Date: Sat, 19 Jan 2019 11:38:36 +0800 Subject: [PATCH] fix clusterManagerGetAntiAffinityScore double free otypes --- src/redis-cli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index a74493ef..b00a4861 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -2471,9 +2471,10 @@ static int clusterManagerGetAntiAffinityScore(clusterManagerNodeArray *ipnodes, } // Master type 'm' is always set as the first character of the // types string. + otypes = sdsdup(otypes); if (!node->replicate) types = sdscatprintf(otypes, "m%s", otypes); else types = sdscat(otypes, "s"); - if (types != otypes) dictReplace(related, key, types); + dictReplace(related, key, types); } /* Now it's trivial to check, for each related group having the * same host, what is their local score. */