Index: trunk/psLib/src/sys/psMemory.c
===================================================================
--- trunk/psLib/src/sys/psMemory.c	(revision 32745)
+++ trunk/psLib/src/sys/psMemory.c	(revision 32746)
@@ -100,4 +100,6 @@
     PS_MEM_ABORT(__func__, "Unsafe to Continue\n"); \
 }
+
+static bool checkingForCorruption = false;
 
 static bool isBadMemBlock(FILE *output, const psMemBlock *memBlock, const char *file, unsigned int lineo, const char *func);
@@ -746,4 +748,7 @@
         }
         fprintf(output, _("\n\tMemory block is corrupted; buffer underflow detected.\n"));
+	if (!checkingForCorruption) {
+	  p_psMemCheckCorruption(__FILE__, __LINE__, __func__, output, false);
+	}
         bad = true;
     }
@@ -755,4 +760,7 @@
         }
         fprintf(output, _("\n\tMemory block is corrupted; buffer overflow detected.\n"));
+	if (!checkingForCorruption) {
+	  p_psMemCheckCorruption(__FILE__, __LINE__, __func__, output, false);
+	}
         bad = true;
     }
@@ -1304,4 +1312,7 @@
     MUTEX_LOCK(&memBlockListMutex);
 
+    // this function calls 'isBadMemBlock', which may in turn call this function : avoid nested calls or we will be stuck forever
+    checkingForCorruption = true;
+
     psS32 nbad = 0;               // number of bad blocks
     for (psMemBlock *memBlock = (psMemBlock *) lastMemBlockAllocated; memBlock != NULL; memBlock = memBlock->nextBlock) {
@@ -1316,4 +1327,6 @@
         }
     }
+
+    checkingForCorruption = true;
 
     // release the lock on the memblock list
