summaryrefslogtreecommitdiff
path: root/lib/northbound.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-12-30 14:38:49 +0000
committerChristian Hopps <chopps@labn.net>2023-12-30 16:03:45 +0000
commit1a7b50a00af57674771564fe49bbc4d5930e1613 (patch)
tree16c0cb551616a5da17dc4be954510028b576504b /lib/northbound.c
parent30e63f2900578c29c1ac6b56dc8f36321658bcec (diff)
lib: fix coverity CID 1574981
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/northbound.c')
-rw-r--r--lib/northbound.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/northbound.c b/lib/northbound.c
index 3b02c08bbf..bf5cc912b5 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -2250,7 +2250,7 @@ int nb_oper_data_iterate(const char *xpath, struct yang_translator *translator,
__func__, xpath);
return ret;
}
-
+ assert(dnode);
/*
* Create a linked list to sort the data nodes starting from the root.
@@ -2331,17 +2331,15 @@ int nb_oper_data_iterate(const char *xpath, struct yang_translator *translator,
flags, cb, arg, dnode);
list_delete(&list_dnodes);
- if (dnode) {
- while (lyd_parent(dnode))
- dnode = lyd_parent(dnode);
+ while (lyd_parent(dnode))
+ dnode = lyd_parent(dnode);
- if (tree && ret == NB_OK)
- *tree = dnode;
- else {
- lyd_free_all(dnode);
- if (tree)
- *tree = NULL;
- }
+ if (tree && ret == NB_OK)
+ *tree = dnode;
+ else {
+ lyd_free_all(dnode);
+ if (tree)
+ *tree = NULL;
}
return ret;