Skip to content
Browse files

Update rdb.c to properly work with new memory strategy for sorted sets

  • Loading branch information...
1 parent 50a9fad commit 56e52b69feebb11931cbe8162ce1749909b7ff30 @pietern pietern committed Sep 22, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/rdb.c
View
9 src/rdb.c
@@ -730,13 +730,14 @@ robj *rdbLoadObject(int type, FILE *fp) {
/* Load every single element of the list/set */
while(zsetlen--) {
robj *ele;
- double *score = zmalloc(sizeof(double));
+ double score;
+ zskiplistNode *znode;
if ((ele = rdbLoadEncodedStringObject(fp)) == NULL) return NULL;
ele = tryObjectEncoding(ele);
- if (rdbLoadDoubleValue(fp,score) == -1) return NULL;
- dictAdd(zs->dict,ele,score);
- zslInsert(zs->zsl,*score,ele);
+ if (rdbLoadDoubleValue(fp,&score) == -1) return NULL;
+ znode = zslInsert(zs->zsl,score,ele);
+ dictAdd(zs->dict,ele,&znode->score);
incrRefCount(ele); /* added to skiplist */
}
} else if (type == REDIS_HASH) {

0 comments on commit 56e52b6

Please sign in to comment.
Something went wrong with that request. Please try again.