Permalink
Browse files

minor fix for the skiplist code, resulting in a false positive with v…

…algrind, and in general into a useless small allocation
  • Loading branch information...
antirez
antirez committed May 21, 2010
1 parent dcb518f commit 2f4dd7e0fd0581ddf630ea5d928a9dce42f175e7
Showing with 3 additions and 1 deletion.
  1. +3 −1 redis.c
View
@@ -5412,8 +5412,10 @@ static zskiplistNode *zslCreateNode(int level, double score, robj *obj) {
zskiplistNode *zn = zmalloc(sizeof(*zn));
zn->forward = zmalloc(sizeof(zskiplistNode*) * level);
- if (level > 0)
+ if (level > 1)
zn->span = zmalloc(sizeof(unsigned int) * (level - 1));
+ else
+ zn->span = NULL;
zn->score = score;
zn->obj = obj;
return zn;

0 comments on commit 2f4dd7e

Please sign in to comment.