Index: trunk/psphot/src/psphotSourceStats.c
===================================================================
--- trunk/psphot/src/psphotSourceStats.c	(revision 9520)
+++ trunk/psphot/src/psphotSourceStats.c	(revision 9734)
@@ -2,5 +2,5 @@
 
 // 2006.02.02 : no leaks
-psArray *psphotSourceStats (pmReadout *readout, psMetadata *recipe, psArray *peaks) 
+psArray *psphotSourceStats (pmReadout *readout, psMetadata *recipe, psArray *peaks)
 {
     bool     status  = false;
@@ -16,63 +16,63 @@
     char *breakPt  = psMetadataLookupStr (&status, recipe, "BREAK_POINT");
 
-    sources = psArrayAlloc (peaks->n);
+    sources = psArrayAllocEmpty (peaks->n);
 
     for (int i = 0; i < peaks->n; i++) {
 
-	// create a new source, add peak
-	pmSource *source = pmSourceAlloc();
-	source->peak = (pmPeak *)psMemIncrRefCounter(peaks->data[i]);
+        // create a new source, add peak
+        pmSource *source = pmSourceAlloc();
+        source->peak = (pmPeak *)psMemIncrRefCounter(peaks->data[i]);
 
-	// allocate image, weight, mask arrays for each peak (square of radius OUTER)
-	pmSourceDefinePixels (source, readout, source->peak->x, source->peak->y, OUTER);
-	if (!strcasecmp (breakPt, "PEAKS")) { 
-	    psArrayAdd (sources, 100, source);
-	    psFree (source);
-	    continue;
-	}
+        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
+        pmSourceDefinePixels (source, readout, source->peak->x, source->peak->y, OUTER);
+        if (!strcasecmp (breakPt, "PEAKS")) {
+            psArrayAdd (sources, 100, source);
+            psFree (source);
+            continue;
+        }
 
-	// XXX skip faint sources?
+        // XXX skip faint sources?
 
-	// measure a local sky value
-	// XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
-	status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER);
-	if (!status) {
-	  psFree (source);
-	  continue;
-	}
+        // measure a local sky value
+        // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
+        status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER);
+        if (!status) {
+          psFree (source);
+          continue;
+        }
 
-	// measure the local sky variance (needed if noise is not sqrt(signal))
-	// XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
-	status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER);
-	if (!status) {
-	  psFree (source);
-	  continue;
-	}
+        // measure the local sky variance (needed if noise is not sqrt(signal))
+        // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken
+        status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER);
+        if (!status) {
+          psFree (source);
+          continue;
+        }
 
-	// measure basic source moments
-	status = pmSourceMoments (source, RADIUS);
-	if (status) {
-	    // add to the source array
-	    psArrayAdd (sources, 100, source);
-	    psFree (source);
-	    continue;
-	}
+        // measure basic source moments
+        status = pmSourceMoments (source, RADIUS);
+        if (status) {
+            // add to the source array
+            psArrayAdd (sources, 100, source);
+            psFree (source);
+            continue;
+        }
 
-	// if no valid pixels, or massive swing, likely saturated source,
-	// try a much larger box
-	BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
-	psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
-	status = pmSourceMoments (source, BIG_RADIUS);
-	if (status) {
-	    // add to the source array
-	    psArrayAdd (sources, 100, source);
-	    psFree (source);
-	    continue;
-	}
+        // if no valid pixels, or massive swing, likely saturated source,
+        // try a much larger box
+        BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
+        psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
+        status = pmSourceMoments (source, BIG_RADIUS);
+        if (status) {
+            // add to the source array
+            psArrayAdd (sources, 100, source);
+            psFree (source);
+            continue;
+        }
 
-	psFree (source);
-	continue;
+        psFree (source);
+        continue;
     }
-     
+
     psLogMsg ("psphot", 3, "%ld moments: %f sec\n", sources->n, psTimerMark ("psphot"));
 
