summaryrefslogtreecommitdiffstats
path: root/lib/yang.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-08 05:18:38 +0100
committerRenato Westphal <renato@opensourcerouting.org>2018-11-26 20:35:58 +0100
commite5dc8a44ee9732dd32358b13dd52e59527e6835f (patch)
treeadcf02114f1efec6e7a738e4ce8cf0b5fad6e8b4 /lib/yang.c
parentlib, tools: use CHECK_FLAG/SET_FLAG more often in the northbound code (diff)
downloadfrr-e5dc8a44ee9732dd32358b13dd52e59527e6835f.tar.xz
frr-e5dc8a44ee9732dd32358b13dd52e59527e6835f.zip
lib: remove entire data tree on yang_dnode_free()
For convenience, make yang_dnode_free() remove the entire data tree and not only the data node given as a parameter. Also, add a null-pointer check on nb_config_replace() before calling yang_dnode_free(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 7daef7919..73f63b18e 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -523,6 +523,8 @@ struct lyd_node *yang_dnode_dup(const struct lyd_node *dnode)
void yang_dnode_free(struct lyd_node *dnode)
{
+ while (dnode->parent)
+ dnode = dnode->parent;
lyd_free_withsiblings(dnode);
}