summaryrefslogtreecommitdiff
path: root/malloc/mcheck.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-27 05:01:11 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-27 05:01:11 +0000
commitadef37445c9c4e1c134e9a2bd1ca8c70472ffb55 (patch)
tree766decb8b700ba5b594b332dd2b0eff7e6111bac /malloc/mcheck.c
parent52d38e0e4029324854a274485c86a2a69228dd92 (diff)
(checkhdr): Disable mcheck before reporting an error. Don't run any tests if mcheck is disabled.
Diffstat (limited to 'malloc/mcheck.c')
-rw-r--r--malloc/mcheck.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index 8612c8cf29..a9993c8d9d 100644
--- a/malloc/mcheck.c
+++ b/malloc/mcheck.c
@@ -55,6 +55,8 @@ struct hdr
It is only constructed if the pedantic testing is requested. */
static struct hdr *root;
+static int mcheck_used;
+
/* Nonzero if pedentic checking of all blocks is requested. */
static int pedantic;
@@ -81,6 +83,12 @@ checkhdr (hdr)
const struct hdr *hdr;
{
enum mcheck_status status;
+
+ if (!mcheck_used)
+ /* Maybe the mcheck used is disabled? This happens when we find
+ an error and report it. */
+ return MCHECK_OK;
+
switch (hdr->magic ^ ((uintptr_t) hdr->prev + (uintptr_t) hdr->next))
{
default:
@@ -97,7 +105,11 @@ checkhdr (hdr)
break;
}
if (status != MCHECK_OK)
- (*abortfunc) (status);
+ {
+ mcheck_used = 0;
+ (*abortfunc) (status);
+ mcheck_used = 1;
+ }
return status;
}
@@ -302,8 +314,6 @@ mabort (status)
#endif
}
-static int mcheck_used;
-
int
mcheck (func)
void (*func) __P ((enum mcheck_status));