tree data BUGFIX support for ext data
diff --git a/src/tree_data.c b/src/tree_data.c
index 0bf1e2d..fff9f3d 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -3560,6 +3560,11 @@
LY_CHECK_ARG_RET(NULL, node, LY_EINVAL);
+ if (node->flags & LYD_EXT) {
+ /* we need to use the same context */
+ trg_ctx = LYD_CTX(node);
+ }
+
if (!node->schema) {
dup = calloc(1, sizeof(struct lyd_node_opaq));
((struct lyd_node_opaq *)dup)->ctx = trg_ctx;
@@ -3591,7 +3596,7 @@
if (options & LYD_DUP_WITH_FLAGS) {
dup->flags = node->flags;
} else {
- dup->flags = (node->flags & LYD_DEFAULT) | LYD_NEW;
+ dup->flags = (node->flags & (LYD_DEFAULT | LYD_EXT)) | LYD_NEW;
}
if (trg_ctx == LYD_CTX(node)) {
dup->schema = node->schema;