X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/68ee18558ab23066b0273ae59b3d6ab63db2dd15..b1ee7da75a4191bf1785f598c158b191104fdc38:/src/sort.c diff --git a/src/sort.c b/src/sort.c index ff655c7e..c1ed5517 100644 --- a/src/sort.c +++ b/src/sort.c @@ -28,7 +28,7 @@ redisSortOperation *createSortOperation(int type, robj *pattern) { robj *lookupKeyByPattern(redisDb *db, robj *pattern, robj *subst) { char *p, *f, *k; sds spat, ssub; - robj *keyobj, *fieldobj, *o; + robj *keyobj, *fieldobj = NULL, *o; int prefixlen, sublen, postfixlen, fieldlen; /* If the pattern is "#" return the substitution object itself in order @@ -76,7 +76,7 @@ robj *lookupKeyByPattern(redisDb *db, robj *pattern, robj *subst) { o = lookupKeyRead(db,keyobj); if (o == NULL) goto noobj; - if (fieldlen > 0) { + if (fieldobj) { if (o->type != REDIS_HASH) goto noobj; /* Retrieve value from hash by the field name. This operation @@ -90,7 +90,7 @@ robj *lookupKeyByPattern(redisDb *db, robj *pattern, robj *subst) { incrRefCount(o); } decrRefCount(keyobj); - if (fieldlen) decrRefCount(fieldobj); + if (fieldobj) decrRefCount(fieldobj); return o; noobj: