X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Falloc-srvx.c;h=047cb95db528b2d5035d429bc7b47e62eb90e1fe;hb=dea629dc3145fbd4de2f45ae7fbbe9bb44f71488;hp=b8e1afab34cc18680d8f344b8a1c3df0b971d428;hpb=17a5d138f4afe234509d2b6d46a3e2fe1b933efc;p=srvx.git diff --git a/src/alloc-srvx.c b/src/alloc-srvx.c index b8e1afa..047cb95 100644 --- a/src/alloc-srvx.c +++ b/src/alloc-srvx.c @@ -19,7 +19,6 @@ #undef malloc #undef free -/* cookies for anybody who recognizes these bytes without help :) */ #define ALLOC_MAGIC 0x1acf #define FREE_MAGIC 0xfc1d const char redzone[] = { '\x03', '\x47', '\x76', '\xc7' }; @@ -132,11 +131,11 @@ srvx_free(const char *file, unsigned int line, void *ptr) block = (struct alloc_header *)ptr - 1; assert(block->magic == ALLOC_MAGIC); assert(0 == memcmp((char*)(block + 1) + block->size, redzone, sizeof(redzone))); - size = block->size + sizeof(*block); - memset(block, 0, size); + size = block->size; + memset(block + 1, 0xde, size); block->magic = FREE_MAGIC; free(block); alloc_count--; - alloc_size -= size - sizeof(*block); + alloc_size -= size; (void)file; (void)line; }