Skip to content

Commit

Permalink
use the right object when cleaning up after zunion/zinter (fixes issu…
Browse files Browse the repository at this point in the history
…e 216)
  • Loading branch information
pietern committed Apr 1, 2010
1 parent 14ae26d commit 8bca877
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -5685,7 +5685,7 @@ static void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
addReplyLong(c, dstzset->zsl->length);
server.dirty++;
} else {
decrRefCount(dstzset);
decrRefCount(dstobj);
addReply(c, shared.czero);
}
zfree(src);
Expand Down
5 changes: 5 additions & 0 deletions test-redis.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,11 @@ proc main {server port} {
list [$r zremrangebyrank zset 1 3] [$r zrange zset 0 -1]
} {3 {a e}}

test {ZUNION against non-existing key doesn't set destination} {
$r del zseta
list [$r zunion dst_key 1 zseta] [$r exists dst_key]
} {0 0}

test {ZUNION basics} {
$r del zseta zsetb zsetc
$r zadd zseta 1 a
Expand Down

0 comments on commit 8bca877

Please sign in to comment.