Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

Commit

Permalink
Fix keytable size calculation
Browse files Browse the repository at this point in the history
We only need to allocate memory for key positions, not
for every argument position.  The most keys we can have
is total arguments / keystep.

Closes redis#1300
  • Loading branch information
hsb0818 authored and mattsta committed Aug 2, 2014
1 parent 8ded06a commit 8abc591
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/db.c
Expand Up @@ -992,7 +992,7 @@ int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, in
}
last = cmd->lastkey;
if (last < 0) last = argc+last;
keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1));
keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1) / cmd->keystep);
for (j = cmd->firstkey; j <= last; j += cmd->keystep) {
redisAssert(j < argc);
keys[i++] = j;
Expand Down

0 comments on commit 8abc591

Please sign in to comment.