From bb671d90165590ecba80942e887b7a455d92384e Mon Sep 17 00:00:00 2001 From: Binbin Date: Sun, 6 Jun 2021 17:13:00 +0800 Subject: [PATCH] Add missing zuiClearIterator in zrandmemberWithCountCommand. (#8979) Also the bug that currently does not cause memory leaks. Because op->type = OBJ_ZSET, in zuiClearIterator, we will do nothing. Just a cleanup that zuiInitIterator and zuiClearIterator should appear in pairs. --- src/t_zset.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/t_zset.c b/src/t_zset.c index fb402816d..1f7040d1c 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -4070,6 +4070,7 @@ void zrandmemberWithCountCommand(client *c, long l, int withscores) { if (withscores) addReplyDouble(c, zval.score); } + zuiClearIterator(&src); return; } @@ -4137,6 +4138,7 @@ void zrandmemberWithCountCommand(client *c, long l, int withscores) { zarndmemberReplyWithZiplist(c, count, keys, vals); zfree(keys); zfree(vals); + zuiClearIterator(&src); return; } @@ -4170,6 +4172,7 @@ void zrandmemberWithCountCommand(client *c, long l, int withscores) { /* Release memory */ dictRelease(d); } + zuiClearIterator(&src); } /* ZRANDMEMBER [ WITHSCORES] */