Skip to content

Commit

Permalink
lib: Ensure SA that root cannot be NULL
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Aug 22, 2024
1 parent 4344ac1 commit 286e6f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/yang.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,10 @@ LY_ERR yang_lyd_trim_xpath(struct lyd_node **root, const char *xpath)
}
}
darr_foreach_i (remove, i) {
if (remove[i] == *root)
if (remove[i] == *root) {
assert(*root);
*root = (*root)->next;
}
lyd_free_tree(remove[i]);
}
darr_free(remove);
Expand Down

0 comments on commit 286e6f8

Please sign in to comment.