summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-07-31 10:39:30 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-07-31 20:37:47 +0000
commit1c7bf5d41737984907e8bad1dc832eb6cb1d6288 (patch)
treee93f89435bec22de3f331b020497b7ee43471caa /src/vppinfra
parent7d92c09b559969fac8b5c1847ed6af2a3bdc9277 (diff)
Poison freed memory objects
When compiled w/ -DCLIB_DEBUG=1, paint 0x13 across freed memory blocks. Should result in a characteristic SIGSEGV if someone dereferences a pointer in a freed vector element, etc. Change-Id: I5f78970f4342310bfbe7adeddb56feff21f0de2c Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/dlmalloc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vppinfra/dlmalloc.c b/src/vppinfra/dlmalloc.c
index 8ae92cf566c..1bc8f656b66 100644
--- a/src/vppinfra/dlmalloc.c
+++ b/src/vppinfra/dlmalloc.c
@@ -4271,6 +4271,14 @@ void mspace_put (mspace msp, void *p_arg)
mheap_put_trace ((u64)p_arg, psize);
}
+#if CLIB_DEBUG > 0
+ /* Poison the object */
+ {
+ size_t psize = mspace_usable_size (object_header);
+ memset (object_header, 0x13, psize);
+ }
+#endif
+
/* And free it... */
mspace_free (msp, object_header);
}