From 854278dff83a754f1d24a17c1c1068e8ebfe6195 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 8 Mar 2005 00:50:21 +0000 Subject: * malloc/arena.c (ptmalloc_init): Recognize MALLOC_PERTURB_ and call mallopt appropriately. * malloc/malloc.h: Define M_PERTURB. * malloc/malloc.c (perturb_byte): New variable. (alloc_perturb, free_perturb): New macros. (_int_malloc): Before returning, overwrite the memory if this is requested. (_int_free): Overwrite freed memory if requested. (mALLOPt): Handle M_PERTURB. * test-skeleton.c: Add call to mallopt with M_PERTURB command. --- test-skeleton.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test-skeleton.c') diff --git a/test-skeleton.c b/test-skeleton.c index 9d9a68b62c..dd5d8041dd 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -1,5 +1,5 @@ /* Skeleton for test programs. - Copyright (C) 1998,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + Copyright (C) 1998,2000-2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -196,6 +197,9 @@ main (int argc, char *argv[]) unsigned int timeoutfactor = 1; pid_t termpid; + /* Make uses of freed and uninitialized memory known. */ + mallopt (M_PERTURB, 42); + #ifdef STDOUT_UNBUFFERED setbuf (stdout, NULL); #endif -- cgit v1.2.3