Index: trunk/psModules/src/astrom/pmAstrometryTable.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryTable.c	(revision 15675)
+++ trunk/psModules/src/astrom/pmAstrometryTable.c	(revision 15676)
@@ -8,6 +8,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-11-21 09:59:40 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-11-21 12:01:10 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -230,5 +230,7 @@
     if (!psFitsWriteTable (file->fits, header, table, "TP")) {
         psError(PS_ERR_IO, false, "writing sky data\n");
-        psFree(table);
+	psFree (region);
+        psFree (table);
+	psFree (header);
         return false;
     }
@@ -284,4 +286,5 @@
     psFree (table);
     psFree (header);
+    psFree (region);
     return true;
 }
@@ -303,4 +306,8 @@
     while ((chip = pmFPAviewNextChip (view, file->fpa, 1)) != NULL) {
 
+	if (!chip->toFPA) continue;
+	assert (chip->toFPA->x);
+	assert (chip->toFPA->y);
+      
 	psRegion *region = pmChipPixels (chip);
 
