From: antirez Date: Thu, 4 Mar 2010 16:00:06 +0000 (+0100) Subject: A fix for initialization of augmented skip lists X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/94e543b5c201fb0a4582af27bf50c21ef629232b A fix for initialization of augmented skip lists --- diff --git a/redis.c b/redis.c index c6283e49..0464554b 100644 --- a/redis.c +++ b/redis.c @@ -4861,7 +4861,10 @@ static zskiplist *zslCreate(void) { zsl->header = zslCreateNode(ZSKIPLIST_MAXLEVEL,0,NULL); for (j = 0; j < ZSKIPLIST_MAXLEVEL; j++) { zsl->header->forward[j] = NULL; - zsl->header->span[j] = 0; + + /* span has space for ZSKIPLIST_MAXLEVEL-1 elements */ + if (j < ZSKIPLIST_MAXLEVEL-1) + zsl->header->span[j] = 0; } zsl->header->backward = NULL; zsl->tail = NULL;