Skip to content

Commit

Permalink
lib: fix coverity CID 1574981
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hopps <[email protected]>
  • Loading branch information
choppsv1 committed Dec 30, 2023
1 parent 30e63f2 commit 1a7b50a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/northbound.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1a7b50a

Please sign in to comment.