Index: /trunk/ippTools/src/pxtree.c
===================================================================
--- /trunk/ippTools/src/pxtree.c	(revision 15189)
+++ /trunk/ippTools/src/pxtree.c	(revision 15190)
@@ -65,5 +65,5 @@
     // if the child already has a parent, release the ref count
     if (child->parent) {
-        psMemDecrRefCounter(child->parent);
+        psFree(child->parent);
     }
     // [re]parent the child
@@ -167,4 +167,8 @@
             // add it to the hash of nodes
             psHashAdd(nodeNames, item->name, node);
+            // node may be used below because it will still have a ref count of
+            // 1 from being on the hash, this is equivalent to the "view" we
+            // get from a hashlookup
+            psFree(node);
         }
 
@@ -178,9 +182,11 @@
                 // add it to the hash of nodes
                 psHashAdd(nodeNames, item->data.str, child);
+                // child may be used below because it will still have a ref
+                // count of 1 from being on the hash, this is equivalent to the
+                // "view" we get from a hashlookup
+                psFree(child);
             }
             pxNodeAddChild(node, child);
         }
-
-        psFree(node);
     }
     psFree(iter);
@@ -189,4 +195,4 @@
     psFree(nodeNames);
 
-    return root;
+    return psMemIncrRefCounter(root);
 }
