]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix coverity CID 1574981
authorChristian Hopps <chopps@labn.net>
Sat, 30 Dec 2023 14:38:49 +0000 (14:38 +0000)
committerChristian Hopps <chopps@labn.net>
Sat, 30 Dec 2023 16:03:45 +0000 (16:03 +0000)
Signed-off-by: Christian Hopps <chopps@labn.net>
lib/northbound.c

index 3b02c08bbfbc8a20ec1362d12087b585c4323c22..bf5cc912b519ef379e3f6c6a975c98608e5a0a4f 100644 (file)
@@ -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;