xpath BUGFIX invalid pointer dereference
@@ -3512,7 +3512,7 @@ xpath_deref(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set
{
struct lysc_ctx cctx;
struct lyd_node_term *leaf;
- struct lysc_node_leaf *sleaf;
+ struct lysc_node_leaf *sleaf = NULL;
const struct lysc_node *target;
const struct lyd_node *node;
char *errmsg = NULL;
@@ -3530,7 +3530,7 @@ xpath_deref(struct lyxp_set **args, uint16_t UNUSED(arg_count), struct lyxp_set
__func__, sleaf->name);
}
set_scnode_clear_ctx(set);
- if ((rc == LY_SUCCESS) && (sleaf->type->basetype == LY_TYPE_LEAFREF)) {
+ if (sleaf && (sleaf->type->basetype == LY_TYPE_LEAFREF)) {
cctx.ctx = set->ctx;
rc = lys_compile_leafref_validate(&cctx, (struct lysc_node *)sleaf, (struct lysc_type_leafref *)sleaf->type, &target);
/* it was already validated, it must succeed */
