summaryrefslogtreecommitdiff
path: root/xc/util
diff options
context:
space:
mode:
Diffstat (limited to 'xc/util')
-rw-r--r--xc/util/memleak/fmalloc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/xc/util/memleak/fmalloc.c b/xc/util/memleak/fmalloc.c
index 473fa8bfe..0c030d943 100644
--- a/xc/util/memleak/fmalloc.c
+++ b/xc/util/memleak/fmalloc.c
@@ -22,7 +22,7 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
-/* $XFree86: xc/util/memleak/fmalloc.c,v 3.6 2000/02/12 03:40:07 dawes Exp $ */
+/* $XFree86: xc/util/memleak/fmalloc.c,v 3.8 2000/06/15 01:26:22 dawes Exp $ */
/*
@@ -157,6 +157,7 @@ unsigned long FindLeakAllocBreakpoint = ~0;
unsigned long FindLeakFreeBreakpoint = ~0;
unsigned long FindLeakTime;
int FindLeakCheckAlways = 0;
+int FindLeakValidateAlways = 0;
static void MarkActiveBlock ();
static int tree_insert (), tree_delete ();
@@ -550,6 +551,11 @@ malloc (desiredsize)
endOfStaticMemory = (mem *) sbrk(0);
if (FindLeakCheckAlways)
CheckMemory ();
+ else if (FindLeakValidateAlways)
+ {
+ ValidateActiveMemory ();
+ ValidateFreedMemory ();
+ }
size = RoundUp(desiredsize);
totalsize = TotalSize (size);
@@ -631,6 +637,11 @@ free (p)
AddFreedBlock (h);
if (FindLeakCheckAlways)
CheckMemory ();
+ else if (FindLeakValidateAlways)
+ {
+ ValidateActiveMemory ();
+ ValidateFreedMemory ();
+ }
}
char *
@@ -645,6 +656,8 @@ realloc (old, desiredsize)
new = malloc (desiredsize);
if (!new)
return NULL;
+ if (!old)
+ return new;
SEARCH(activeMemory, h, old);
if (!h)
{