]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added poisoning of free'd objects when we're debugging.
authorMartin Mares <mj@ucw.cz>
Tue, 16 May 2000 13:51:31 +0000 (13:51 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 16 May 2000 13:51:31 +0000 (13:51 +0000)
lib/slab.c

index 0a3455fb0e1fb207a79221efd95fb063c1b75eb0..6c56044f1fd67acdcdd6eab53e5b4536892b02d7 100644 (file)
 
 #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)