diff options
author | Martin Mares <mj@ucw.cz> | 2000-05-16 15:51:31 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-05-16 15:51:31 +0200 |
commit | b8e60d3562277762ec372424482b22c024e657d6 (patch) | |
tree | 824f294312436c301b51f061a4c47406410baf0d /lib/slab.c | |
parent | df9f0fb30a7046872eff21624a315d5fd56e938f (diff) | |
download | bird-b8e60d3562277762ec372424482b22c024e657d6.tar bird-b8e60d3562277762ec372424482b22c024e657d6.zip |
Added poisoning of free'd objects when we're debugging.
Diffstat (limited to 'lib/slab.c')
-rw-r--r-- | lib/slab.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -16,6 +16,10 @@ #undef FAKE_SLAB /* Turn on if you want to debug memory allocations */ +#ifdef DEBUGGING +#define POISON /* Poison all regions after they are freed */ +#endif + static void slab_free(resource *r); static void slab_dump(resource *r); static resource *slab_lookup(resource *r, unsigned long addr); @@ -221,6 +225,9 @@ sl_free(slab *s, void *oo) struct sl_obj *o = SKIP_BACK(struct sl_obj, u.data, oo); struct sl_head *h = o->slab; +#ifdef POISON + memset(oo, 0xdb, s->obj_size); +#endif o->u.next = h->first_free; h->first_free = o; if (!--h->num_full) |