schema parsers BUGFIX memory leak
diff --git a/src/resolve.c b/src/resolve.c
index 3e3d19e..def7039 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -6474,7 +6474,7 @@
dictstr = lydict_insert(mod->ctx, str, 0);
rc = unres_schema_add_node(mod, unres, item, type, (struct lys_node *)dictstr);
- if (rc == -1) {
+ if (rc < 0) {
lydict_remove(mod->ctx, dictstr);
}
return rc;
@@ -6489,7 +6489,8 @@
* @param[in] type Type of the unresolved item. UNRES_TYPE_DER is handled specially!
* @param[in] snode Schema node argument.
*
- * @return EXIT_SUCCESS on success, EXIT_FIALURE on storing the item in unres, -1 on error.
+ * @return EXIT_SUCCESS on success, EXIT_FIALURE on storing the item in unres, -1 on error, -2 if the unres item
+ * is already in the unres list.
*/
int
unres_schema_add_node(struct lys_module *mod, struct unres_schema *unres, void *item, enum UNRES_ITEM type,
@@ -6507,7 +6508,7 @@
if (unres->type[u] == type && unres->item[u] == item &&
unres->str_snode[u] == snode && unres->module[u] == mod) {
/* duplication, will be resolved later */
- return EXIT_FAILURE;
+ return -2;
}
}