Index: /trunk/archive/pslib/src/Utils/trace.c
===================================================================
--- /trunk/archive/pslib/src/Utils/trace.c	(revision 176)
+++ /trunk/archive/pslib/src/Utils/trace.c	(revision 177)
@@ -41,6 +41,6 @@
 /*****************************************************************************/
 
-static Component *componentNew(const char *name,
-			       int level)
+static Component *componentAlloc(const char *name,
+				 int level)
 {
     Component *comp = psAlloc(sizeof(Component));
@@ -54,15 +54,16 @@
 }
 
-static void componentDel(Component *comp)
+static void componentFree(Component *comp)
 {
     if (comp == NULL) { return; }
 
     if (comp->subcomp != NULL) {
-	for (int i = 0; comp->subcomp[i] != NULL; i++) {
-	    componentDel(comp->subcomp[i]);
+	for (int i = 0; i < comp->n; i++) {
+	    componentFree(comp->subcomp[i]);
 	}
 	psFree(comp->subcomp);
     }
 
+    psFree((char *)comp->name);
     psFree(comp);
 }
@@ -76,6 +77,16 @@
 static void initTrace(void) {
     if (croot == NULL) {
-	croot = componentNew("", UNKNOWN_LEVEL);
-    }
+	croot = componentAlloc("", UNKNOWN_LEVEL);
+    }
+}
+
+/*****************************************************************************/
+/*
+ * Free the trace tree information
+ */
+void psTraceReset(void)
+{
+    componentFree(croot);
+    croot = NULL;
 }
 
@@ -128,5 +139,5 @@
     }
 
-    Component *fcpt0 = componentNew(cpt0, UNKNOWN_LEVEL);
+    Component *fcpt0 = componentAlloc(cpt0, UNKNOWN_LEVEL);
     int i;
     for (i = 0; i < comp->n; i++) {
@@ -295,4 +306,6 @@
 int main(void)
 {
+    psSetLogFormat("NM");		// suppress some of the psLogMsg verbosity
+    
 #if 0
     psSetTraceLevel("", 10);
@@ -322,4 +335,9 @@
     psTrace("aaa.bbb.eee", 2, "aaa.bbb.eee\n");
 
+    psTraceReset();
+    fprintf(stderr,"Checking for memory leaks:\n");
+    psMemCheckLeaks(0, NULL, stderr);
+    
+
     return 0;
 }
