data tree BUGFIX memory leak on failure
diff --git a/src/tree_data.c b/src/tree_data.c
index e799ff2..e50849b 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1446,6 +1446,8 @@
         if (new_node) {
             *new_node = nnode;
         }
+    } else {
+        lyd_free_tree(nparent);
     }
     return ret;
 }