Index: trunk/pswarp/src/pswarpCleanup.c
===================================================================
--- trunk/pswarp/src/pswarpCleanup.c	(revision 37053)
+++ trunk/pswarp/src/pswarpCleanup.c	(revision 41510)
@@ -14,20 +14,20 @@
 // Lists of file rules which we may need to save here
 static char *outputFiles[] = {
-  "PSWARP.OUTPUT",
-  "PSWARP.OUTPUT.MASK",
-  "PSWARP.OUTPUT.VARIANCE",
-  "PSWARP.OUTPUT.BKGMODEL",
-  "PSWARP.OUTPUT.SOURCES",
-  "PSPHOT.OUTPUT",
-  "PSPHOT.RESID",
-  "PSPHOT.BACKMDL",
-  "PSPHOT.BACKMDL.STDEV",
-  "PSPHOT.BACKGND",
-  "PSPHOT.BACKSUB",
-  "PSPHOT.PSF.SAVE",
-  "SOURCE.PLOT.MOMENTS",
-  "SOURCE.PLOT.PSFMODEL",
-  "SOURCE.PLOT.APRESID",
-  NULL
+    "PSWARP.OUTPUT",
+    "PSWARP.OUTPUT.MASK",
+    "PSWARP.OUTPUT.VARIANCE",
+    "PSWARP.OUTPUT.BKGMODEL",
+    "PSWARP.OUTPUT.SOURCES",
+    "PSPHOT.OUTPUT",
+    "PSPHOT.RESID",
+    "PSPHOT.BACKMDL",
+    "PSPHOT.BACKMDL.STDEV",
+    "PSPHOT.BACKGND",
+    "PSPHOT.BACKSUB",
+    "PSPHOT.PSF.SAVE",
+    "SOURCE.PLOT.MOMENTS",
+    "SOURCE.PLOT.PSFMODEL",
+    "SOURCE.PLOT.APRESID",
+    NULL
 };
 
@@ -53,4 +53,5 @@
 	psError(psErrorCodeLast(), false, "Unable to read files.");
 	pmFPAfileFreeSetStrict(false);
+	psFree(view);
 	goto DONE;
     }
@@ -63,4 +64,5 @@
 	    psError(psErrorCodeLast(), false, "Unable to read files.");
 	    pmFPAfileFreeSetStrict(false);
+	    psFree(view);
 	    goto DONE;
 	}
@@ -73,4 +75,5 @@
 		psError(psErrorCodeLast(), false, "Unable to read files.");
 		pmFPAfileFreeSetStrict(false);
+		psFree(view);
 		goto DONE;
 	    }
@@ -79,4 +82,5 @@
 	    psError(psErrorCodeLast(), false, "Unable to write files.");
 	    pmFPAfileFreeSetStrict(false);
+	    psFree(view);
 	    goto DONE;
 	}
@@ -85,4 +89,5 @@
 	psError(psErrorCodeLast(), false, "Unable to write files.");
 	pmFPAfileFreeSetStrict(false);
+	psFree(view);
 	goto DONE;
     }
@@ -116,4 +121,8 @@
     psLibFinalize();
 
+    psMemBlock **memblocks;
+    int Nleaks = psMemCheckLeaks (0, &memblocks, stderr, false);
+    fprintf (stderr, "Found %d leaks at %s\n", Nleaks, "ppImage");
+
 DONE:
     exitValue = pswarpExitCode(exitValue);
