Skip to content

Commit 693ffb5

Browse files
committed
schema parsers BUGFIX memory leak
1 parent 5d62745 commit 693ffb5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/resolve.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6503,7 +6503,7 @@ unres_schema_add_str(struct lys_module *mod, struct unres_schema *unres, void *i
65036503
dictstr = lydict_insert(mod->ctx, str, 0);
65046504
rc = unres_schema_add_node(mod, unres, item, type, (struct lys_node *)dictstr);
65056505

6506-
if (rc == -1) {
6506+
if (rc < 0) {
65076507
lydict_remove(mod->ctx, dictstr);
65086508
}
65096509
return rc;
@@ -6518,7 +6518,8 @@ unres_schema_add_str(struct lys_module *mod, struct unres_schema *unres, void *i
65186518
* @param[in] type Type of the unresolved item. UNRES_TYPE_DER is handled specially!
65196519
* @param[in] snode Schema node argument.
65206520
*
6521-
* @return EXIT_SUCCESS on success, EXIT_FIALURE on storing the item in unres, -1 on error.
6521+
* @return EXIT_SUCCESS on success, EXIT_FIALURE on storing the item in unres, -1 on error, -2 if the unres item
6522+
* is already in the unres list.
65226523
*/
65236524
int
65246525
unres_schema_add_node(struct lys_module *mod, struct unres_schema *unres, void *item, enum UNRES_ITEM type,
@@ -6536,7 +6537,7 @@ unres_schema_add_node(struct lys_module *mod, struct unres_schema *unres, void *
65366537
if (unres->type[u] == type && unres->item[u] == item &&
65376538
unres->str_snode[u] == snode && unres->module[u] == mod) {
65386539
/* duplication, will be resolved later */
6539-
return EXIT_FAILURE;
6540+
return -2;
65406541
}
65416542
}
65426543

0 commit comments

Comments
 (0)