Index: /trunk/psphot/src/psphotFitSourcesLinear.c
===================================================================
--- /trunk/psphot/src/psphotFitSourcesLinear.c	(revision 28398)
+++ /trunk/psphot/src/psphotFitSourcesLinear.c	(revision 28399)
@@ -27,24 +27,24 @@
     for (int i = 0; i < num; i++) {
 
-	// find the currently selected readout
-	pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest
-	psAssert (file, "missing file?");
-
-	pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
-	psAssert (readout, "missing readout?");
-
-	pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
-	psAssert (detections, "missing detections?");
-
-	psArray *sources = detections->allSources;
-	psAssert (sources, "missing sources?");
-
-	pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
-	psAssert (psf, "missing psf?");
-
-	if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final)) {
+        // find the currently selected readout
+        pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest
+        psAssert (file, "missing file?");
+
+        pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
+        psAssert (readout, "missing readout?");
+
+        pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
+        psAssert (detections, "missing detections?");
+
+        psArray *sources = detections->allSources;
+        psAssert (sources, "missing sources?");
+
+        pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
+        psAssert (psf, "missing psf?");
+
+        if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final)) {
             psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i);
-	    return false;
-	}
+            return false;
+        }
     }
     return true;
@@ -59,6 +59,6 @@
 
     if (!sources->n) {
-	psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping linear fit");
-	return true;
+        psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping linear fit");
+        return true;
     }
 
@@ -150,4 +150,5 @@
 
     if (fitSources->n == 0) {
+        psFree(fitSources);
         return true;
     }
