about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'malloc')
-rw-r--r--malloc/Versions2
-rw-r--r--malloc/mcheck.c17
-rw-r--r--malloc/mcheck.h3
3 files changed, 13 insertions, 9 deletions
diff --git a/malloc/Versions b/malloc/Versions
index 43207549a6..759a0636c1 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -50,6 +50,6 @@ libc {
   }
   GLIBC_2.2 {
     # m*
-    mcheck_pedantic;
+    mcheck_check_all; mcheck_pedantic;
   }
 }
diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index 0d32fc17f7..9aa07a2e1f 100644
--- a/malloc/mcheck.c
+++ b/malloc/mcheck.c
@@ -103,9 +103,8 @@ checkhdr (hdr)
   return status;
 }
 
-static void check_all __P ((void));
-static void
-check_all ()
+void
+mcheck_check_all ()
 {
   /* Walk through all the active blocks and test whether they were tempered
      with.  */
@@ -172,7 +171,7 @@ freehook (ptr, caller)
      const __ptr_t caller;
 {
   if (pedantic)
-    check_all ();
+    mcheck_check_all ();
   if (ptr)
     {
       struct hdr *hdr = ((struct hdr *) ptr) - 1;
@@ -200,7 +199,7 @@ mallochook (size, caller)
   struct hdr *hdr;
 
   if (pedantic)
-    check_all ();
+    mcheck_check_all ();
 
   __malloc_hook = old_malloc_hook;
   if (old_malloc_hook != NULL)
@@ -230,7 +229,7 @@ reallochook (ptr, size, caller)
   __malloc_size_t osize;
 
   if (pedantic)
-    check_all ();
+    mcheck_check_all ();
 
   if (ptr)
     {
@@ -331,8 +330,10 @@ int
 mcheck_pedantic (func)
       void (*func) __P ((enum mcheck_status));
 {
-  pedantic = 1;
-  return mcheck (func);
+  int res = mcheck (func);
+  if (res == 0)
+    pedantic = 1;
+  return res;
 }
 
 enum mcheck_status
diff --git a/malloc/mcheck.h b/malloc/mcheck.h
index 2b8bbb2cbf..afc7335403 100644
--- a/malloc/mcheck.h
+++ b/malloc/mcheck.h
@@ -45,6 +45,9 @@ extern int mcheck (void (*__abortfunc) (enum mcheck_status)) __THROW;
    the memory handling functions is called.  This can be very slow.  */
 extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status)) __THROW;
 
+/* Force check of all blocks now.  */
+extern void mcheck_check_all (void);
+
 /* Check for aberrations in a particular malloc'd block.  You must have
    called `mcheck' already.  These are the same checks that `mcheck' does
    when you free or reallocate a block.  */