Index: /branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c
===================================================================
--- /branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c	(revision 6385)
+++ /branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c	(revision 6386)
@@ -288,5 +288,5 @@
     int nCells = cells->n;
 
-    // Modify the "original" pixels
+    // Fix up the HDU
     if (chip->parent->hdu) {
         psLogMsg(__func__, PS_LOG_WARN, "The original format has the entire FPA in a single extension.  "
@@ -311,5 +311,5 @@
     }
 
-    // Chop off all the component cells, and put in a new one
+    // Chop off all the component cells, and construct a new one
     pmCell *newCell = pmCellAlloc(NULL, NULL, __func__); // New cell
     cellConcepts(newCell, cells, xBinChip, yBinChip);
@@ -326,7 +326,7 @@
     // This preserves the relationship there was before, where freeing the parent frees the child.
     psRegion entire = {0.0, 0.0, 0.0, 0.0};
-    newReadout->image = psImageSubset(image, entire);
-    newReadout->weight = psImageSubset(weight, entire);
-    newReadout->mask = psImageSubset(mask, entire);
+    newReadout->image = psMemIncrRefCounter(psImageSubset(image, entire));
+    newReadout->weight = psMemIncrRefCounter(psImageSubset(weight, entire));
+    newReadout->mask = psMemIncrRefCounter(psImageSubset(mask, entire));
     // Drop references
     psFree(newReadout);
Index: /branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c
===================================================================
--- /branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c	(revision 6385)
+++ /branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c	(revision 6386)
@@ -12,6 +12,6 @@
 * XXX: Should we implement non-linear cell->chip transforms?
 *
-*  @version $Revision: 1.1.2.8 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-08 01:16:11 $
+*  @version $Revision: 1.1.2.9 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-08 23:02:02 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -182,4 +182,7 @@
     for (psS32 i = 0 ; i < readouts->n ; i++) {
         pmReadout *tmpReadout = readouts->data[i];
+        if (! tmpReadout) {
+            continue;
+        }
         readouts->data[i] = NULL;
         tmpReadout->parent = NULL;
@@ -206,4 +209,7 @@
     for (int i = 0 ; i < cells->n ; i++) {
         pmCell *tmpCell = cells->data[i];
+        if (! tmpCell) {
+            continue;
+        }
         cells->data[i] = NULL;
         tmpCell->parent = NULL;
Index: /branches/eam_rel9_p0/psModules/src/astrom/pmFPARead.c
===================================================================
--- /branches/eam_rel9_p0/psModules/src/astrom/pmFPARead.c	(revision 6385)
+++ /branches/eam_rel9_p0/psModules/src/astrom/pmFPARead.c	(revision 6386)
@@ -121,5 +121,5 @@
         psRegion *biassec = NULL;       // A BIASSEC region from the list
         while ((biassec = psListGetAndIncrement(iter))) {
-            psImage *overscan = psImageSubset(image, *biassec);
+            psImage *overscan = psMemIncrRefCounter(psImageSubset(image, *biassec));
             psListAdd(readout->bias, PS_LIST_TAIL, overscan);
             psFree(overscan);
Index: /branches/eam_rel9_p0/psModules/src/astrom/pmReadout.c
===================================================================
--- /branches/eam_rel9_p0/psModules/src/astrom/pmReadout.c	(revision 6385)
+++ /branches/eam_rel9_p0/psModules/src/astrom/pmReadout.c	(revision 6386)
@@ -17,5 +17,5 @@
     psRegion *region = NULL;            // Bias region from list
     while ((region = psListGetAndIncrement(sectionsIter))) {
-        psImage *bias = psImageSubset(image, *region); // Image from bias section
+        psImage *bias = psMemIncrRefCounter(psImageSubset(image, *region)); // Image from bias section
         psListAdd(images, PS_LIST_TAIL, bias);
         psFree(bias);
Index: /branches/eam_rel9_p0/psModules/src/imsubtract/pmSubtractBias.c
===================================================================
--- /branches/eam_rel9_p0/psModules/src/imsubtract/pmSubtractBias.c	(revision 6385)
+++ /branches/eam_rel9_p0/psModules/src/imsubtract/pmSubtractBias.c	(revision 6386)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.6.8.1.2.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-08 00:53:55 $
+ *  @version $Revision: 1.6.8.1.2.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-08 23:02:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -572,5 +572,4 @@
         }
         psFree(myStats);
-        psFree(overscans);
     } // End of overscan subtraction
 
