parser BUGFIX memory-leak due to tpdfs_nodes
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index e48abc4..26be190 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -957,6 +957,7 @@
struct lysp_node_container *c = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
+ YCTX->main_ctx = (struct lys_parser_ctx *)YCTX;
/* invalid cardinality */
#define TEST_DUP(MEMBER, VALUE1, VALUE2) \
@@ -1132,6 +1133,7 @@
struct lysp_node_list *l = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
+ YCTX->main_ctx = (struct lys_parser_ctx *)YCTX;
/* invalid cardinality */
#define TEST_DUP(MEMBER, VALUE1, VALUE2) \
@@ -1303,6 +1305,7 @@
struct lysp_node_grp *grp = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
+ YCTX->main_ctx = (struct lys_parser_ctx *)YCTX;
/* invalid cardinality */
#define TEST_DUP(MEMBER, VALUE1, VALUE2) \
@@ -1353,6 +1356,7 @@
struct lysp_node_container *c = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
+ YCTX->main_ctx = (struct lys_parser_ctx *)YCTX;
/* invalid cardinality */
#define TEST_DUP(MEMBER, VALUE1, VALUE2) \
@@ -1421,6 +1425,7 @@
struct lysp_node_container *c = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
+ YCTX->main_ctx = (struct lys_parser_ctx *)YCTX;
/* invalid cardinality */
#define TEST_DUP(MEMBER, VALUE1, VALUE2) \
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 21d5994..3799065 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -158,9 +158,8 @@
static int
teardown_ctx(void **UNUSED(state))
{
- lyxml_ctx_free(YCTX->xmlctx);
lys_module_free(YCTX->parsed_mod->mod);
- free(YCTX);
+ yin_parser_ctx_free(YCTX);
YCTX = NULL;
return 0;
@@ -755,6 +754,7 @@
{LY_STMT_ARG_VALUE, dest, 0}
};
+ YCTX->main_ctx = (struct lys_parser_ctx *)YCTX;
ly_in_new_memory(data, &UTEST_IN);
lyxml_ctx_new(UTEST_LYCTX, UTEST_IN, &YCTX->xmlctx);
prefix = YCTX->xmlctx->prefix;
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index 70b0f8a..e5d20f4 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -269,6 +269,11 @@
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
CHECK_LOG("Invalid name \"y\" of typedef - name collision with sibling type.", NULL);
+ str = "module a {namespace urn:a; prefix a; container c {typedef x {type t{}}";
+ assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EVALID);
+ CHECK_STRING(_UC->err_msg, "Unexpected end-of-input.");
+ UTEST_LOG_CLEAN;
+
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule b {belongs-to a {prefix a;} typedef x {type string;}}");
str = "module a {namespace urn:a; prefix a; include b; typedef x {type int8;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);