Index: trunk/psphot/src/psphotSetup.c
===================================================================
--- trunk/psphot/src/psphotSetup.c	(revision 5672)
+++ trunk/psphot/src/psphotSetup.c	(revision 5754)
@@ -27,9 +27,9 @@
     char *input = psMetadataLookupPtr (&status, config, "IMAGE");
     if (!status) psAbort ("psphot", "input image not specified");
-    psFits *file = psFitsAlloc (input);
+    psFits *file = psFitsOpen (input, "r");
     header = psFitsReadHeader (header, file);
     psImage *tmpimage = psFitsReadImage (NULL, file, region, 0);
     image = psImageCopy (NULL, tmpimage, PS_TYPE_F32);
-    psFree (file);
+    psFitsClose (file);
     
     // psFree (input);
@@ -46,7 +46,7 @@
     char *weightName = psMetadataLookupPtr (&status, config, "WEIGHT");
     if (status == true) {
-	file = psFitsAlloc (weightName);
+	file = psFitsOpen (weightName, "r");
 	weight = psFitsReadImage  (NULL, file, region, 0);
-	psFree (file);
+	psFitsClose (file);
 	// psFree (weightName); XXX - see psFree (input)
     } else {
@@ -64,7 +64,7 @@
     if (status == true) {
 	// XXX EAM require / convert mask to psU8?
-	file = psFitsAlloc (maskName);
+	file = psFitsOpen (maskName, "r");
 	mask  = psFitsReadImage  (NULL, file, region, 0);
-	psFree (file);
+	psFitsClose (file);
 	// psFree (maskName); XXX - see psFree (input)
     } else {
