Index: /branches/eam_branch_20070830/psphot/src/psphotApResid.c
===================================================================
--- /branches/eam_branch_20070830/psphot/src/psphotApResid.c	(revision 14950)
+++ /branches/eam_branch_20070830/psphot/src/psphotApResid.c	(revision 14951)
@@ -189,5 +189,10 @@
     psFree (xPos);
     psFree (yPos);
+
     psFree (apResid);
+    psFree (apResidFit);
+    psFree (apResidRes);
+
+    psFree (dMagSys);
     psFree (dMag);
 
@@ -269,8 +274,4 @@
     int Nx, Ny;
 	
-    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
-    stats->min = 2.0;
-    stats->max = 3.0;
-
     if (readout->image->numCols > readout->image->numRows) {
 	Nx = scale;
@@ -285,4 +286,9 @@
     }
 
+    // XXX stats structure for use by ApTrend : make parameters user setable
+    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
+    stats->min = 2.0;
+    stats->max = 3.0;
+
     // measure Trend2D for the current spatial scale
     psFree (psf->ApTrend);
Index: /branches/eam_branch_20070830/psphot/src/psphotMosaicSubimage.c
===================================================================
--- /branches/eam_branch_20070830/psphot/src/psphotMosaicSubimage.c	(revision 14950)
+++ /branches/eam_branch_20070830/psphot/src/psphotMosaicSubimage.c	(revision 14951)
@@ -41,4 +41,5 @@
     psImageOverlaySection (outImage, newImage, Xo, Yo, "=");
 
+    psFree (subImage);
     psFree (newImage);
     return true;
