Skip to content

Commit 4a94ebc

Browse files
bugfix lyd_dup find first sibling explicitly
the first_dup may not always remain the first sibling. It must be explicitly found.
1 parent 29e9db2 commit 4a94ebc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/tree_data.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,12 @@ lyd_dup(const struct lyd_node *node, const struct ly_ctx *trg_ctx, struct lyd_no
23252325
}
23262326

23272327
if (dup_p) {
2328+
/* get the first sibling explicitly, first_dup may not be first */
2329+
if (!nosiblings) {
2330+
while (first_dup->prev->next) {
2331+
first_dup = first_dup->prev;
2332+
}
2333+
}
23282334
*dup_p = first_dup;
23292335
}
23302336
return LY_SUCCESS;

0 commit comments

Comments
 (0)