]> git.saurik.com Git - redis.git/blobdiff - redis.c
use the right object when cleaning up after zunion/zinter (fixes issue 216)
[redis.git] / redis.c
diff --git a/redis.c b/redis.c
index bb0e200408545c8ad90020c9f4d28461cb71cda9..04d8b0be4d837ccec3043ee4185831d8081c77a6 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -5685,7 +5685,7 @@ static void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
         addReplyLong(c, dstzset->zsl->length);
         server.dirty++;
     } else {
-        decrRefCount(dstzset);
+        decrRefCount(dstobj);
         addReply(c, shared.czero);
     }
     zfree(src);
@@ -6000,10 +6000,8 @@ static void hsetCommand(redisClient *c) {
         decrRefCount(valobj);
         o->ptr = zm;
 
-        /* And here there is the second check for hash conversion...
-         * we want to do it only if the operation was not just an update as
-         * zipmapLen() is O(N). */
-        if (!update && zipmapLen(zm) > server.hash_max_zipmap_entries)
+        /* And here there is the second check for hash conversion. */
+        if (zipmapLen(zm) > server.hash_max_zipmap_entries)
             convertToRealHash(o);
     } else {
         tryObjectEncoding(c->argv[2]);
@@ -6021,7 +6019,6 @@ static void hsetCommand(redisClient *c) {
 }
 
 static void hincrbyCommand(redisClient *c) {
-    int update = 0;
     long long value = 0, incr = 0;
     robj *o = lookupKeyWrite(c->db,c->argv[1]);
 
@@ -6058,13 +6055,12 @@ static void hincrbyCommand(redisClient *c) {
         value += incr;
         sds svalue = sdscatprintf(sdsempty(),"%lld",value);
         zm = zipmapSet(zm,c->argv[2]->ptr,sdslen(c->argv[2]->ptr),
-            (unsigned char*)svalue,sdslen(svalue),&update);
+            (unsigned char*)svalue,sdslen(svalue),NULL);
         sdsfree(svalue);
         o->ptr = zm;
 
-        /* Check if the zipmap needs to be converted
-         * if this was not an update. */
-        if (!update && zipmapLen(zm) > server.hash_max_zipmap_entries)
+        /* Check if the zipmap needs to be converted. */
+        if (zipmapLen(zm) > server.hash_max_zipmap_entries)
             convertToRealHash(o);
     } else {
         robj *hval;