Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 14214)
+++ trunk/ippTools/src/regtool.c	(revision 14958)
@@ -119,5 +119,5 @@
     // select newImfiles that:
     // exp_id is in newExp
-    // don't have their exp_id in rawExp 
+    // don't have their exp_id in rawExp
     // XXX having the same exp_id in newExp and raw*Exp is probably an error
     // that should be checked for
@@ -137,5 +137,5 @@
 
     if (!p_psDBRunQuery(config->dbh, query)) {
-	// XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
+        // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
         psError(PXTOOLS_ERR_PROG, false, "database error");
         psFree(query);
@@ -155,5 +155,5 @@
                 psError(PXTOOLS_ERR_PROG, false, "unknown error");
         }
-        
+
         return false;
     }
@@ -167,6 +167,6 @@
     simple = psMetadataLookupBool(&status, config->args, "-simple");
     if (!status) {
-	psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -simple");
-	return false;
+        psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -simple");
+        return false;
     }
 
@@ -278,5 +278,5 @@
             newImfileRow *object = newImfileObjectFromMetadata(output->data[i]);
             // convert newImfile object -> rawImfile object
-            rawImfileRow *imfile = newToRawImfile(config, object); 
+            rawImfileRow *imfile = newToRawImfile(config, object);
             if (!imfile) {
                 // rollback
@@ -482,5 +482,5 @@
 
     // return only exps that:
-    // are not in rawExp 
+    // are not in rawExp
     // have ALL of their imfiles in rawImfile (by count)
     // and have no associated imfiles left in newImfile
@@ -499,5 +499,5 @@
 
     if (!p_psDBRunQuery(config->dbh, query)) {
-	// XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
+        // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms)
         psError(PXTOOLS_ERR_PROG, false, "database error");
         psFree(query);
@@ -529,6 +529,6 @@
     simple = psMetadataLookupBool(&status, config->args, "-simple");
     if (!status) {
-	psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -simple");
-	return false;
+        psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -simple");
+        return false;
     }
 
@@ -554,5 +554,5 @@
     // exp_id is not in newImfile
     // that the correct count of imfiles is in rawImfile
-   
+
     bool status = false;
     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
@@ -672,5 +672,5 @@
         // done)
         if (detrend) {
-            // set the state for the newExp to stop 
+            // set the state for the newExp to stop
             if (!pxnewExpSetState(config, exp_id, "stop")) {
                 // rollback
@@ -683,4 +683,5 @@
                 return false;
             }
+            psFree(rawExp);
             continue;
         }
