tree schema BUGFIX unlinking derived identities on error
Fixes #1808
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 9625ea9..6c18238 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -104,7 +104,7 @@
static int
teardown(void **state)
{
- lys_module_free(PARSER_CUR_PMOD(YCTX)->mod);
+ lys_module_free(PARSER_CUR_PMOD(YCTX)->mod, 0);
LOG_LOCBACK(0, 0, 0, 1);
ly_set_free(YCTX->parsed_mods, NULL);
@@ -552,7 +552,7 @@
struct ly_ctx *ly_ctx = PARSER_CUR_PMOD(ctx)->mod->ctx;
struct lysp_module *pmod;
- lys_module_free(PARSER_CUR_PMOD(ctx)->mod);
+ lys_module_free(PARSER_CUR_PMOD(ctx)->mod, 0);
pmod = calloc(1, sizeof *pmod);
ctx->parsed_mods->objs[0] = pmod;
pmod->mod = calloc(1, sizeof *pmod->mod);
@@ -570,7 +570,7 @@
struct ly_ctx *ly_ctx = PARSER_CUR_PMOD(ctx)->mod->ctx;
struct lysp_submodule *submod;
- lys_module_free(PARSER_CUR_PMOD(ctx)->mod);
+ lys_module_free(PARSER_CUR_PMOD(ctx)->mod, 0);
submod = calloc(1, sizeof *submod);
ctx->parsed_mods->objs[0] = submod;
submod->mod = calloc(1, sizeof *submod->mod);
@@ -772,7 +772,7 @@
assert_int_equal(LY_EVALID, yang_parse_module(&ctx_p, &in, m));
CHECK_LOG_CTX("Trailing garbage \"module q {names...\" after module, expected end-of-input.", "Line number 1.");
yang_parser_ctx_free(ctx_p);
- lys_module_free(m);
+ lys_module_free(m, 0);
in.current = "prefix " SCHEMA_BEGINNING "}";
m = calloc(1, sizeof *m);
@@ -780,7 +780,7 @@
assert_int_equal(LY_EVALID, yang_parse_module(&ctx_p, &in, m));
CHECK_LOG_CTX("Invalid keyword \"prefix\", expected \"module\" or \"submodule\".", "Line number 1.");
yang_parser_ctx_free(ctx_p);
- lys_module_free(m);
+ lys_module_free(m, 0);
in.current = "module " SCHEMA_BEGINNING "leaf enum {type enumeration {enum seven { position 7;}}}}";
m = calloc(1, sizeof *m);
@@ -788,7 +788,7 @@
assert_int_equal(LY_EVALID, yang_parse_module(&ctx_p, &in, m));
CHECK_LOG_CTX("Invalid keyword \"position\" as a child of \"enum\".", "Line number 1.");
yang_parser_ctx_free(ctx_p);
- lys_module_free(m);
+ lys_module_free(m, 0);
/* extensions */
TEST_GENERIC("prefix:test;}", mod->exts,
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 59353a4..81c4eae 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -162,7 +162,7 @@
static int
teardown_ctx(void **UNUSED(state))
{
- lys_module_free(PARSER_CUR_PMOD(YCTX)->mod);
+ lys_module_free(PARSER_CUR_PMOD(YCTX)->mod, 0);
yin_parser_ctx_free(YCTX);
YCTX = NULL;
@@ -3428,7 +3428,7 @@
struct ly_ctx *ly_ctx = PARSER_CUR_PMOD(ctx)->mod->ctx;
struct lysp_module *pmod;
- lys_module_free(PARSER_CUR_PMOD(ctx)->mod);
+ lys_module_free(PARSER_CUR_PMOD(ctx)->mod, 0);
pmod = calloc(1, sizeof *pmod);
ctx->parsed_mods->objs[0] = pmod;
pmod->mod = calloc(1, sizeof *pmod->mod);
@@ -3558,7 +3558,7 @@
struct ly_ctx *ly_ctx = PARSER_CUR_PMOD(ctx)->mod->ctx;
struct lysp_submodule *submod;
- lys_module_free(PARSER_CUR_PMOD(ctx)->mod);
+ lys_module_free(PARSER_CUR_PMOD(ctx)->mod, 0);
submod = calloc(1, sizeof *submod);
ctx->parsed_mods->objs[0] = submod;
submod->mod = calloc(1, sizeof *submod->mod);
@@ -3717,7 +3717,7 @@
assert_int_equal(yin_parse_module(&yin_ctx, in, mod), LY_SUCCESS);
assert_null(mod->parsed->exts->child->next->child);
assert_string_equal(mod->parsed->exts->child->next->arg, "test");
- lys_module_free(mod);
+ lys_module_free(mod, 0);
yin_parser_ctx_free(yin_ctx);
ly_in_free(in, 0);
mod = NULL;
@@ -3755,7 +3755,7 @@
"</module>\n";
assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
assert_int_equal(yin_parse_module(&yin_ctx, in, mod), LY_SUCCESS);
- lys_module_free(mod);
+ lys_module_free(mod, 0);
yin_parser_ctx_free(yin_ctx);
ly_in_free(in, 0);
mod = NULL;
@@ -3770,7 +3770,7 @@
"</module>\n";
assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
assert_int_equal(yin_parse_module(&yin_ctx, in, mod), LY_SUCCESS);
- lys_module_free(mod);
+ lys_module_free(mod, 0);
yin_parser_ctx_free(yin_ctx);
ly_in_free(in, 0);
mod = NULL;
@@ -3783,7 +3783,7 @@
assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
assert_int_equal(yin_parse_module(&yin_ctx, in, mod), LY_EINVAL);
CHECK_LOG_CTX("Input data contains submodule which cannot be parsed directly without its main module.", NULL);
- lys_module_free(mod);
+ lys_module_free(mod, 0);
yin_parser_ctx_free(yin_ctx);
ly_in_free(in, 0);
@@ -3798,7 +3798,7 @@
assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
assert_int_equal(yin_parse_module(&yin_ctx, in, mod), LY_EVALID);
CHECK_LOG_CTX("Trailing garbage \"<module>\" after module, expected end-of-input.", "Line number 6.");
- lys_module_free(mod);
+ lys_module_free(mod, 0);
yin_parser_ctx_free(yin_ctx);
ly_in_free(in, 0);
mod = NULL;