parser BUGFIX unique
It does not check the return value of function unres_schema_add_str in unique statement.
diff --git a/src/parser_yang.c b/src/parser_yang.c
index f54e02c..b5ddd75 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -601,7 +601,9 @@
}
/* try to resolve leaf */
if (unres) {
- unres_schema_add_str(module, unres, (struct lys_node *)list, UNRES_LIST_UNIQ, unique->expr[i]);
+ if (unres_schema_add_str(module, unres, (struct lys_node *) list, UNRES_LIST_UNIQ, unique->expr[i]) == -1) {
+ goto error;
+ }
} else {
if (resolve_unique((struct lys_node *)list, unique->expr[i])) {
goto error;
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 44fe43a..2b1b4cd 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -1123,7 +1123,9 @@
/* try to resolve leaf */
if (unres) {
- unres_schema_add_str(module, unres, parent, UNRES_LIST_UNIQ, unique->expr[i]);
+ if (unres_schema_add_str(module, unres, parent, UNRES_LIST_UNIQ, unique->expr[i]) == -1){
+ goto error;
+ }
} else {
if (resolve_unique(parent, unique->expr[i])) {
goto error;