summaryrefslogtreecommitdiff
path: root/xc/util
diff options
context:
space:
mode:
authoralanh <alanh>2000-07-10 21:17:26 +0000
committeralanh <alanh>2000-07-10 21:17:26 +0000
commit30722f5171428576252260bfe13e2dcd8f622a4d (patch)
treeda831e272145819ef138fd4ca1183f2b782ac2d1 /xc/util
parent55378d1c9953642fb1b327237d51287d4d8beefb (diff)
Import of XFree86 4.0.1X_4_0_1
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)
{