schema compile BUGFIX freeing schemas being compiled as a dependency
As a reaction to a compile error, all the schemas previously compiled as
a dependency are supposed to be reverted back to the not-implemented
state. Freeing such schemas-compiled-by-dependency must be done
carefully since some of them could actually cause compilation of the
module which failed and is going to free the dependency modules. We use
current context's set id to identify which modules are safe to free and
which will be freed later when the call stack will return to them.
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 5b8c1a4..d807838 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -92,7 +92,7 @@
}
if (implement && !mod->implemented) {
/* make the module implemented */
- ret = lys_set_implemented_internal((struct lys_module*)mod, 2);
+ ret = lys_set_implemented_internal((struct lys_module*)mod, ctx->ctx->module_set_id);
LY_CHECK_RET(ret);
}
if (context_node && (context_node->nodetype & (LYS_RPC | LYS_ACTION))) {