Index: trunk/ppImage/src/ppImageLoop.c
===================================================================
--- trunk/ppImage/src/ppImageLoop.c	(revision 6125)
+++ trunk/ppImage/src/ppImageLoop.c	(revision 6148)
@@ -1,3 +1,5 @@
 # include "ppImage.h"
+
+#define MEM_LEAKS 1
 
 psMemId ppMemPrint(const psMemBlock *ptr)
@@ -63,8 +65,4 @@
     for (int i = 0; i < chips->n; i++) {
 
-        if (i > 6) {
-            continue;
-        }
-
         if (processChip >= 0 && i != processChip) {
             continue;
@@ -84,4 +82,6 @@
         pmChip *maskChip  = data->mask->fpa->chips->data[i];
         pmChip *flatChip  = data->flat->fpa->chips->data[i];
+
+        ppMemPrint((psMemBlock*)inputChip-1);
 
         psArray *cells = inputChip->cells;
@@ -107,8 +107,10 @@
 
             // Need to free detrend cells here so we have enough memory to do other stuff
+#ifndef MEM_LEAKS
             psFree(detrend.bias);
             psFree(detrend.dark);
             psFree(detrend.mask);
             psFree(detrend.flat);
+#endif
         }
 
@@ -118,5 +120,6 @@
         // XXX EAM: Photometry goes here!
 
-        // A kludge to get the write to behave wrt the concepts
+        // A kludge to get the write to behave wrt the concepts --- we've changed the camera format, so
+        // the concepts don't know what on earth to do.
         const psMetadata *camera = data->input->fpa->camera;
         data->input->fpa->camera = NULL;
@@ -125,6 +128,8 @@
 
         // Now I can blow away the mosaic so I can then read more.
-        psFree(chips->data[i]);
+#ifndef MEM_LEAKS
+        pmChipFreeCells(inputChip);
         ppMemPrint((psMemBlock*)chips->data[i]-1);
+#endif
     }
 
@@ -152,8 +157,10 @@
 
     // Free the detrend FPA and chips
+#ifndef MEM_LEAKS
     psFree(data->bias);
     psFree(data->dark);
     psFree(data->mask);
     psFree(data->flat);
+#endif
 
     psFitsClose(data->output);
