diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2018-11-08 05:18:38 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2018-11-26 20:35:58 +0100 |
commit | e5dc8a44ee9732dd32358b13dd52e59527e6835f (patch) | |
tree | adcf02114f1efec6e7a738e4ce8cf0b5fad6e8b4 /lib/yang.c | |
parent | lib, tools: use CHECK_FLAG/SET_FLAG more often in the northbound code (diff) | |
download | frr-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.c | 2 |
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); } |