Permalink
Browse files

check object type in lookupKeyByPattern

  • Loading branch information...
1 parent 705dad3 commit b6f07345c9e4383ac444c895e08e7998ae404915 @pietern pietern committed Apr 16, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 redis.c
View
@@ -6533,6 +6533,10 @@ static robj *lookupKeyByPattern(redisDb *db, robj *pattern, robj *subst) {
initStaticStringObject(fieldobj,((char*)&fieldname)+(sizeof(long)*2));
o = hashGet(o, &fieldobj);
} else {
+ if (o->type != REDIS_STRING) {
+ return NULL;
+ }
+
/* Every object that this function returns needs to have its refcount
* increased. sortCommand decreases it again. */
incrRefCount(o);
@@ -6707,10 +6711,6 @@ static void sortCommand(redisClient *c) {
/* lookup value to sort by */
byval = lookupKeyByPattern(c->db,sortby,vector[j].obj);
if (!byval) continue;
- if (byval->type != REDIS_STRING) {
- decrRefCount(byval);
- continue;
- }
} else {
/* use object itself to sort by */
byval = vector[j].obj;

0 comments on commit b6f0734

Please sign in to comment.