parser yang BUGFIX wrong detect restriction in union
diff --git a/src/resolve.c b/src/resolve.c
index 5642ef3..509b6c7 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -6713,9 +6713,12 @@
yin = (struct lyxml_elem *)((struct lys_type *)unres->item[i])->der;
if (yin->flags & LY_YANG_STRUCTURE_FLAG) {
yang =(struct yang_type *)yin;
- yang->type->base = yang->base;
+ ((struct lys_type *)unres->item[i])->base = yang->base;
lydict_remove(ctx, yang->name);
free(yang);
+ if (((struct lys_type *)unres->item[i])->base == LY_TYPE_UNION) {
+ yang_free_type_union(ctx, (struct lys_type *)unres->item[i]);
+ }
} else {
lyxml_free(ctx, yin);
}