summaryrefslogtreecommitdiff
path: root/lib/northbound_oper.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2024-01-15 07:03:34 -0500
committerGitHub <noreply@github.com>2024-01-15 07:03:34 -0500
commitf2bb6874268b271e49ca2acdc5dba5efd2b0b697 (patch)
treef44cc26dec9896b45d2a3c4139b1ea30fd2f3e75 /lib/northbound_oper.c
parentbd9174f424bd33e75895160aa1f4a63dae795460 (diff)
parent2764344bcbd37c5ea69231d6e51ba9cd58edbb44 (diff)
Merge pull request #15154 from idryzhov/mgmt-get-data
mgmtd get-data request expansion
Diffstat (limited to 'lib/northbound_oper.c')
-rw-r--r--lib/northbound_oper.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/northbound_oper.c b/lib/northbound_oper.c
index afce773181..2394b5e865 100644
--- a/lib/northbound_oper.c
+++ b/lib/northbound_oper.c
@@ -515,8 +515,18 @@ static enum nb_error nb_op_ys_init_node_infos(struct nb_op_yield_state *ys)
/* Move up to the container if on a leaf currently. */
if (node &&
- !CHECK_FLAG(node->schema->nodetype, LYS_CONTAINER | LYS_LIST))
+ !CHECK_FLAG(node->schema->nodetype, LYS_CONTAINER | LYS_LIST)) {
+ struct lyd_node *leaf = node;
+
node = &node->parent->node;
+
+ /*
+ * If the leaf is not a key, delete it, because it has a wrong
+ * empty value.
+ */
+ if (!lysc_is_key(leaf->schema))
+ lyd_free_tree(leaf);
+ }
assert(!node ||
CHECK_FLAG(node->schema->nodetype, LYS_CONTAINER | LYS_LIST));
if (!node)