When debugging an issue, sometimes it can be useful to be able to use
byte 0 to poison memory areas, resulting in the same effect as a calloc().
This patch changes the default mem_poison_byte to -1 to disable it so that
all positive values are usable.
static inline void *p_malloc(size_t size)
{
void *ret = malloc(size);
- if (mem_poison_byte && ret)
+ if (mem_poison_byte >= 0 && ret)
memset(ret, mem_poison_byte, size);
return ret;
}
char name[12]; /* name of the pool */
};
-/* poison each newly allocated area with this byte if not null */
-extern char mem_poison_byte;
+/* poison each newly allocated area with this byte if >= 0 */
+extern int mem_poison_byte;
/*
* This function destroys a pull by freeing it completely.
void *p;
p = pool_alloc_dirty(pool);
- if (p && mem_poison_byte)
+ if (p && mem_poison_byte >= 0)
memset(p, mem_poison_byte, pool->size);
return p;
}
#include <proto/log.h>
static struct list pools = LIST_HEAD_INIT(pools);
-char mem_poison_byte = 0;
+int mem_poison_byte = -1;
/* Try to find an existing shared pool with the same characteristics and
* returns it, otherwise creates this one. NULL is returned if no memory