diff options
author | antirez <antirez@gmail.com> | 2014-04-18 13:01:04 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-04-18 16:16:20 +0200 |
commit | be145453c69c1407302163b59f2d6efcd2bc21c2 (patch) | |
tree | 4327ae8b727876bf8efdaccf4ffc327b4e6d67b6 | |
parent | 115782b1d7ef48fb113ebef64795d2c551fa16ab (diff) | |
download | redis-be145453c69c1407302163b59f2d6efcd2bc21c2.tar.gz |
ZREMRANGEBYLEX memory leak removed calling zslFreeLexRange().
-rw-r--r-- | src/t_zset.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/t_zset.c b/src/t_zset.c index 90a2a5280..60cebfe48 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -1406,7 +1406,7 @@ void zremrangeGenericCommand(redisClient *c, int rangetype) { /* Step 2: Lookup & range sanity checks if needed. */ if ((zobj = lookupKeyWriteOrReply(c,key,shared.czero)) == NULL || - checkType(c,zobj,REDIS_ZSET)) return; + checkType(c,zobj,REDIS_ZSET)) goto cleanup; if (rangetype == ZRANGE_RANK) { /* Sanitize indexes. */ @@ -1419,7 +1419,7 @@ void zremrangeGenericCommand(redisClient *c, int rangetype) { * The range is empty when start > end or start >= length. */ if (start > end || start >= llen) { addReply(c,shared.czero); - return; + goto cleanup; } if (end >= llen) end = llen-1; } @@ -1473,6 +1473,9 @@ void zremrangeGenericCommand(redisClient *c, int rangetype) { } server.dirty += deleted; addReplyLongLong(c,deleted); + +cleanup: + if (rangetype == ZRANGE_LEX) zslFreeLexRange(&lexrange); } void zremrangebyrankCommand(redisClient *c) { |