Index: /trunk/ippTools/src/pzgetexp.c
===================================================================
--- /trunk/ippTools/src/pzgetexp.c	(revision 10019)
+++ /trunk/ippTools/src/pzgetexp.c	(revision 10020)
@@ -31,10 +31,34 @@
 #define PRODUCT_LS_CMD "dsproductls"
 
+static bool go (pxConfig *config);
 static psArray *parseFileSets(pxConfig *config, const char *str);
 
 int main(int argc, char **argv)
 {
+    psLibInit(NULL);
+
     pxConfig *config = pzgetexpConfig(NULL, argc, argv);
 
+    if (!go(config)) {
+        goto FAIL;
+    }
+
+    psFree(config);
+    pmConfigDone();
+    psLibFinalize();
+
+    exit(EXIT_SUCCESS);
+
+FAIL:
+    psFree(config);
+    pmConfigDone();
+    psLibFinalize();
+
+    exit(EXIT_FAILURE);
+}
+
+static bool go(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, NULL);
     // find last fileset/exp_id (if we have one)
     bool haveLastFileSet = false;
@@ -75,6 +99,5 @@
     }
 
-    // XXX debugging
-    fprintf(stderr, "cmd is: %s\n", cmd);
+    psTrace("pzgetexp", PS_LOG_INFO, "cmd is: %s\n", cmd);
 
     FILE *output = popen(cmd, "r");
@@ -214,4 +237,6 @@
     psString line;
     while ((line = psListGetAndIncrement(lineCursor))) {
+        psTrace("pzgetimfile", PS_LOG_INFO, "parsing line: %s\n", line);
+
         // split line into tokens
         psList *tokens = psStringSplit(line, " ", false);
@@ -286,9 +311,19 @@
         }
 
+        // must be freed after the new metadata is built -- holds the strings
+        psFree(tokenCursor);
+        psFree(tokens);
+
         // add the new metadata to the result set
         psArrayAdd(summitExps, 0, md);
 
-        psFree(tokenCursor);
-        psFree(tokens);
+        // debugging
+        if (psTraceGetLevel("pzgetexp") == PS_LOG_INFO) {
+            psString doc = psMetadataConfigFormat(md);
+            psTrace("pzgetexp", PS_LOG_INFO, "parsed line as:\n %s\n", doc);
+            psFree(doc);
+        }
+
+        psFree(md);
 
     }
