tree data BUGFIX invalid memory access
diff --git a/src/tree_data.c b/src/tree_data.c
index a9146d4..5158f93 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2315,7 +2315,7 @@
     struct lyd_node *first_dup = NULL;    /* the first duplicated node, this is returned */
     struct lyd_node *top = NULL;          /* the most higher created node */
     struct lyd_node *local_parent = NULL; /* the direct parent node for the duplicated node(s) */
-    struct lyd_node *dup;                 /* duplicate node */
+    struct lyd_node *dup = NULL;          /* duplicate node */
     struct lyd_node *first_sibling = NULL; /* first sibling node */
 
     assert(node && trg_ctx);