Index: trunk/psLib/src/sys/psMemory.c
===================================================================
--- trunk/psLib/src/sys/psMemory.c	(revision 11265)
+++ trunk/psLib/src/sys/psMemory.c	(revision 11416)
@@ -10,6 +10,6 @@
 *  @author Joshua Hoblitt, University of Hawaii
 *
-*  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-01-24 22:14:48 $
+*  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-01-30 03:00:50 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -355,5 +355,9 @@
 }
 
-int psMemCheckCorruption(FILE *output, bool abort_on_error)
+int p_psMemCheckCorruption(FILE *output,
+                           bool abort_on_error,
+                           const char *file,
+                           unsigned int lineno,
+                           const char *func)
 {
     // get exclusive access to the memBlock list to avoid it changing on us
@@ -561,12 +565,19 @@
  * Check for memory leaks.
  */
-int psMemCheckLeaks(psMemId id0,
-                    psMemBlock ***array,
-                    FILE * fd,
-                    bool persistence)
+int p_psMemCheckLeaks(psMemId id0,
+                      psMemBlock ***array,
+                      FILE * fd,
+                      bool persistence,
+                      const char *file,
+                      unsigned int lineno,
+                      const char *func)
 {
     psS32 nleak = 0;
     psS32 j = 0;
     psMemBlock *topBlock = lastMemBlockAllocated;
+
+    // make sure that the memblock list is free of corruption before we crawl
+    // the list
+    p_psMemCheckCorruption(fd, true, file, lineno, func);
 
     MUTEX_LOCK(&memBlockListMutex);
