diff --git a/src/parser_common.c b/src/parser_common.c index 6dbac0854..5dadecfe5 100644 --- a/src/parser_common.c +++ b/src/parser_common.c @@ -70,7 +70,7 @@ lyd_parser_notif_eventtime_validate(const struct lyd_node *node) { LY_ERR rc = LY_SUCCESS; struct ly_ctx *ctx = (struct ly_ctx *)LYD_CTX(node); - struct lysc_ctx cctx; + struct lysc_ctx cctx = {0}; const struct lys_module *mod1, *mod2; const struct lysc_node *schema; LY_ARRAY_COUNT_TYPE u; diff --git a/src/schema_compile.c b/src/schema_compile.c index bb83147b2..d21f0dc1a 100644 --- a/src/schema_compile.c +++ b/src/schema_compile.c @@ -221,7 +221,7 @@ lys_identity_precompile(struct lysc_ctx *ctx_sc, struct ly_ctx *ctx, struct lysp const struct lysp_ident *identities_p, struct lysc_ident **identities) { LY_ARRAY_COUNT_TYPE u; - struct lysc_ctx cctx; + struct lysc_ctx cctx = {0}; struct lysc_ident *ident; LY_ERR ret = LY_SUCCESS; @@ -1477,7 +1477,7 @@ lys_compile_unres_depset(struct ly_ctx *ctx, struct lys_glob_unres *unres) } cleanup: - lysf_ctx_erase(&cctx.free_ctx); + assert(!cctx.free_ctx.ext_set.count); return ret; } @@ -1557,8 +1557,8 @@ lys_compile_depset_r(struct ly_ctx *ctx, struct ly_set *dep_set, struct lys_glob } cleanup: + assert(!fctx.ext_set.count); lys_compile_unres_depset_erase(ctx, unres); - lysf_ctx_erase(&fctx); return ret; } @@ -1702,7 +1702,7 @@ lys_compile_unres_mod_erase(struct lysc_ctx *ctx, ly_bool error) LY_ERR lys_compile(struct lys_module *mod, struct lys_depset_unres *unres) { - struct lysc_ctx ctx; + struct lysc_ctx ctx = {0}; struct lysc_module *mod_c = NULL; struct lysp_module *sp; struct lysp_submodule *submod; @@ -1823,7 +1823,7 @@ LY_ERR lys_compile_identities(struct lys_module *mod) { LY_ERR rc = LY_SUCCESS; - struct lysc_ctx ctx; + struct lysc_ctx ctx = {0}; struct lysp_submodule *submod; LY_ARRAY_COUNT_TYPE u; diff --git a/src/schema_compile.h b/src/schema_compile.h index 49f75d28d..8f67ce361 100644 --- a/src/schema_compile.h +++ b/src/schema_compile.h @@ -67,7 +67,6 @@ struct lysc_ctx { * @param[in] CTX libyang context. */ #define LYSC_CTX_INIT_CTX(CCTX, CTX) \ - memset(&(CCTX), 0, sizeof (CCTX)); \ (CCTX).ctx = (CTX); \ (CCTX).path_len = 1; \ (CCTX).path[0] = '/'; \ @@ -81,7 +80,6 @@ struct lysc_ctx { * @param[in] EXT Ancestor extension instance. */ #define LYSC_CTX_INIT_PMOD(CCTX, PMOD, EXT) \ - memset(&(CCTX), 0, sizeof (CCTX)); \ (CCTX).ctx = (PMOD)->mod->ctx; \ (CCTX).cur_mod = (PMOD)->mod; \ (CCTX).pmod = (PMOD); \ diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c index 21cb632ea..6179220b3 100644 --- a/src/schema_compile_amend.c +++ b/src/schema_compile_amend.c @@ -2443,7 +2443,7 @@ lys_precompile_mod_augments_deviations(struct lysp_module *pmod, struct ly_set * { LY_ERR ret = LY_SUCCESS; LY_ARRAY_COUNT_TYPE u, v; - struct lysc_ctx ctx; + struct lysc_ctx ctx = {0}; struct lys_module *m; struct lysp_node_augment *aug; struct ly_set set = {0};