Index: /trunk/FACT++/src/EventBuilder.c
===================================================================
--- /trunk/FACT++/src/EventBuilder.c	(revision 12459)
+++ /trunk/FACT++/src/EventBuilder.c	(revision 12460)
@@ -232,5 +232,11 @@
     while (EtiMemoryChunks[chunkIndex].nFreeSlots == EtiMemoryChunks[chunkIndex].nSlots)
     {//free this chunk
+        if (EtiMemoryChunks[chunkIndex].pointers[0] == NULL)
+        {
+            factOut(kError, "Chunk %d not allocated as it ought to be. Skipping release", chunkIndex);
+            return;
+        }
         free(EtiMemoryChunks[chunkIndex].pointers[0]);
+        EtiMemoryChunks[chunkIndex].pointers[0] = NULL;
         numAllocatedChunks--;
         chunkIndex--;
@@ -463,4 +469,6 @@
       mBufferMapping[i].eventNumber = -1;
       mBufferMapping[i].slot = -1;
+      for (i=0;i<MAX_CHUNKS;i++)
+          EtiMemoryChunks[i].pointers[0] = NULL;
       //END ETIENNE
    }
