Index: trunk/psphot/src/setup.c
===================================================================
--- trunk/psphot/src/setup.c	(revision 4642)
+++ trunk/psphot/src/setup.c	(revision 4901)
@@ -29,4 +29,6 @@
     image = psFitsReadImage (NULL, file, region, 0);
     psFree (file);
+    // psFree (input);
+    // XXX - does the current API expect to get a copy or a view?
 
     // grab these values from the approrpiate location (image header if necessary)
@@ -42,4 +44,5 @@
       noise = psFitsReadImage  (NULL, file, region, 0);
       psFree (file);
+      // psFree (noiseName); XXX - see psFree (input)
     } else {
 
@@ -73,4 +76,5 @@
       mask  = psFitsReadImage  (NULL, file, region, 0);
       psFree (file);
+      // psFree (maskName); XXX - see psFree (input)
       // XXX require / convert mask to psU8?
     } else {
@@ -96,13 +100,9 @@
 	}
     }
+
     psLogMsg ("psphot", 3, "load data: %f sec\n", psTimerMark ("psphot"));
 
     // save the image data & return it
-    psImageData *imdata = psAlloc(sizeof(psImageData));
-    imdata->image = image;
-    imdata->header = header;
-    imdata->noise = noise;
-    imdata->mask = mask;
-
+    psImageData *imdata = psImageDataAlloc(image, noise, mask, header);
     return (imdata);
 }
