From 1b20d937f379c03537843cda49fdd7d4fdfbd5ab Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 26 Apr 2001 13:46:43 +0000 Subject: Update. * malloc/mcheck.c (mcheck): Call malloc once before setting the hooks to allow the internal check hooks to be set up if necessary. --- malloc/mcheck.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'malloc') diff --git a/malloc/mcheck.c b/malloc/mcheck.c index f17bc0c0c5..971e2e52c6 100644 --- a/malloc/mcheck.c +++ b/malloc/mcheck.c @@ -315,6 +315,10 @@ mcheck (func) /* These hooks may not be safely inserted if malloc is already in use. */ if (__malloc_initialized <= 0 && !mcheck_used) { + /* We call malloc() once here to ensure it is initialized. */ + void *p = malloc (0); + free (p); + old_free_hook = __free_hook; __free_hook = freehook; old_malloc_hook = __malloc_hook; -- cgit v1.2.1