tree data BUGFIX memory leak

Refs #2011
diff --git a/src/tree_data_new.c b/src/tree_data_new.c
index 2ff090a..2f92c7e 100644
--- a/src/tree_data_new.c
+++ b/src/tree_data_new.c
@@ -299,6 +299,10 @@
         /* restore logging */
         ly_temp_log_options(NULL);
     }
+    if (rc && *tree) {
+        lyd_free_siblings(*tree);
+        *tree = NULL;
+    }
     return rc;
 }