libyang UPDATE minor improvements
diff --git a/src/schema_compile.c b/src/schema_compile.c
index 58d458a..9ed1070 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -114,8 +114,7 @@
LY_CHECK_GOTO(ret = lysp_ext_instance_resolve_argument(ctx->ctx, ext_p, ext_def), cleanup);
}
- DUP_STRING(ctx->ctx, ext_p->argument, ext->argument, ret);
- LY_CHECK_RET(ret);
+ DUP_STRING_GOTO(ctx->ctx, ext_p->argument, ext->argument, ret, cleanup);
if (ext->def->plugin && ext->def->plugin->compile) {
if (ext->argument) {
@@ -280,7 +279,7 @@
*/
static LY_ERR
lys_identity_precompile(struct lysc_ctx *ctx_sc, struct ly_ctx *ctx, struct lysp_module *parsed_mod,
- struct lysp_ident *identities_p, struct lysc_ident **identities)
+ const struct lysp_ident *identities_p, struct lysc_ident **identities)
{
LY_ARRAY_COUNT_TYPE u;
struct lysc_ctx context = {0};
@@ -307,7 +306,7 @@
lysc_update_path(ctx_sc, NULL, identities_p[u].name);
/* add new compiled identity */
- LY_ARRAY_NEW_RET(ctx_sc->ctx, *identities, ident, LY_EMEM);
+ LY_ARRAY_NEW_GOTO(ctx_sc->ctx, *identities, ident, ret, done);
DUP_STRING_GOTO(ctx_sc->ctx, identities_p[u].name, ident->name, ret, done);
DUP_STRING_GOTO(ctx_sc->ctx, identities_p[u].dsc, ident->dsc, ret, done);
@@ -320,7 +319,12 @@
lysc_update_path(ctx_sc, NULL, NULL);
}
lysc_update_path(ctx_sc, NULL, NULL);
+
done:
+ if (ret) {
+ lysc_update_path(ctx_sc, NULL, NULL);
+ lysc_update_path(ctx_sc, NULL, NULL);
+ }
return ret;
}
diff --git a/src/validation.c b/src/validation.c
index b321107..269079a 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -1856,12 +1856,12 @@
}
if (int_opts & (LYD_INTOPT_RPC | LYD_INTOPT_ACTION | LYD_INTOPT_REPLY)) {
- if (!(op_node->schema->nodetype & (LYS_RPC | LYS_ACTION))) {
+ if (!op_node || !(op_node->schema->nodetype & (LYS_RPC | LYS_ACTION))) {
LOGERR(LYD_CTX(op_tree), LY_EINVAL, "No RPC/action to validate found.");
return LY_EINVAL;
}
} else {
- if (op_node->schema->nodetype != LYS_NOTIF) {
+ if (!op_node || (op_node->schema->nodetype != LYS_NOTIF)) {
LOGERR(LYD_CTX(op_tree), LY_EINVAL, "No notification to validate found.");
return LY_EINVAL;
}