From 2f996f02174343ce766710fc6871e2e6df8e73c6 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 22 Jul 2010 15:48:57 +0200 Subject: [PATCH] defensive programming: set o->ptr to NULL before freeing objects --- src/object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/object.c b/src/object.c index 7abecfc64..51582619e 100644 --- a/src/object.c +++ b/src/object.c @@ -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))