Index: /trunk/psastro/src/psastroExtractFindChip.c
===================================================================
--- /trunk/psastro/src/psastroExtractFindChip.c	(revision 23666)
+++ /trunk/psastro/src/psastroExtractFindChip.c	(revision 23667)
@@ -93,14 +93,27 @@
 	psPlaneTransformApply (&ptCH, chip->fromFPA, &ptFP);
 
-	if (ptCH.x <  region->x0) continue;
-	if (ptCH.x >= region->x1) continue;
-	if (ptCH.y <  region->y0) continue;
-	if (ptCH.y >= region->y1) continue;
+	if (ptCH.x <  region->x0) goto next_chip;
+	if (ptCH.x >= region->x1) goto next_chip;
+	if (ptCH.y <  region->y0) goto next_chip;
+	if (ptCH.y >= region->y1) goto next_chip;
+	psFree (region);
 
 	*xChip = ptCH.x;
 	*yChip = ptCH.y;
 	return chip;
+
+    next_chip:
+	psFree (region);
     }
 
     return NULL;
 }
+
+bool psastroExtractFreeChipBounds () {
+  
+  psFree (chipXmin);
+  psFree (chipXmax);
+  psFree (chipYmin);
+  psFree (chipYmax);
+  return true;
+}
