aboutsummaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-26 13:46:43 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-26 13:46:43 +0000
commit1b20d937f379c03537843cda49fdd7d4fdfbd5ab (patch)
tree93fb66a2d83a8a3c00e54d02face33021981814d /malloc
parent48a92e9d2da28b7bef8474f1effda68c13ed2fd1 (diff)
downloadglibc-1b20d937f379c03537843cda49fdd7d4fdfbd5ab.zip
glibc-1b20d937f379c03537843cda49fdd7d4fdfbd5ab.tar.gz
glibc-1b20d937f379c03537843cda49fdd7d4fdfbd5ab.tar.bz2
Update.
* malloc/mcheck.c (mcheck): Call malloc once before setting the hooks to allow the internal check hooks to be set up if necessary.
Diffstat (limited to 'malloc')
-rw-r--r--malloc/mcheck.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index f17bc0c..971e2e5 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;