Skip to content

Commit

Permalink
instanceid BUGFIX redunant check causing wrong comparison (CESNET#2173)
Browse files Browse the repository at this point in the history
* removed unnecessary check, that s1->predicates not equals to NULL.
  It's possible due LY_ARRAY_COUNT can handles NULL pointer by itself.
* before this fix comparison old value without predicate and a new one
  with predicate returned LY_SUCCES instead of LY_ENOT
  • Loading branch information
optimden authored Feb 14, 2024
1 parent 0e1e509 commit 035851a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins_types/instanceid.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ lyplg_type_compare_instanceid(const struct lyd_value *val1, const struct lyd_val
struct ly_path *s1 = &val1->target[u];
struct ly_path *s2 = &val2->target[u];

if ((s1->node != s2->node) || (s1->predicates && (LY_ARRAY_COUNT(s1->predicates) != LY_ARRAY_COUNT(s2->predicates)))) {
if ((s1->node != s2->node) || (LY_ARRAY_COUNT(s1->predicates) != LY_ARRAY_COUNT(s2->predicates))) {
return LY_ENOT;
}
LY_ARRAY_FOR(s1->predicates, v) {
Expand Down

0 comments on commit 035851a

Please sign in to comment.