Index: branches/eam_branches/psphot.20100506/src/psphotStackReadout.c
===================================================================
--- branches/eam_branches/psphot.20100506/src/psphotStackReadout.c	(revision 27932)
+++ branches/eam_branches/psphot.20100506/src/psphotStackReadout.c	(revision 27939)
@@ -150,5 +150,4 @@
     // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
     psphotFitSourcesLinearStack (config, objects, FALSE);
-    psFree (objects);
 
     // identify CRs and extended sources
@@ -157,10 +156,11 @@
     // measure aperture photometry corrections
     if (!psphotApResid (config, view, STACK_OUT)) {
+	psFree (objects);
         psLogMsg ("psphot", 3, "failed on psphotApResid");
 	return psphotReadoutCleanup (config, view, STACK_OUT);
     }
 
-    psphotRadialApertures (config, view, STACK_OUT); 
-    psphotExtendedSourceAnalysis (config, view, STACK_OUT); // pass 1 (detections->allSources)
+    psphotRadialAperturesByObject (config, objects, view, STACK_OUT); 
+    psphotExtendedSourceAnalysisByObject (config, objects, view, STACK_OUT); // pass 1 (detections->allSources)
     psphotExtendedSourceFits (config, view, STACK_OUT); // pass 1 (detections->allSources)
 
@@ -186,4 +186,6 @@
     psphotStackRemoveChisqFromInputs(config, STACK_RAW);
 
+    psFree (objects);
+
     // create the exported-metadata and free local data
     return psphotReadoutCleanup (config, view, STACK_OUT);
