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.
This commit is contained in:
Binbin 2021-06-06 17:13:00 +08:00 committed by GitHub
parent 156599ba2d
commit bb671d9016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 [<count> WITHSCORES] */