]> git.saurik.com Git - redis.git/blobdiff - src/object.c
defensive programming: set o->ptr to NULL before freeing objects
[redis.git] / src / object.c
index 7abecfc64600073575b3a4831374a11226355ecf..51582619e12526ca6cec434cd50eee27055f8fe0 100644 (file)
@@ -179,6 +179,7 @@ void decrRefCount(void *obj) {
         case REDIS_HASH: freeHashObject(o); break;
         default: redisPanic("Unknown object type"); break;
         }
+        o->ptr = NULL; /* defensive programming. We'll see NULL in traces. */
         if (server.vm_enabled) pthread_mutex_lock(&server.obj_freelist_mutex);
         if (listLength(server.objfreelist) > REDIS_OBJFREELIST_MAX ||
             !listAddNodeHead(server.objfreelist,o))