schema parser BUGFIX correct order of freeing schema and unres list in case of failure
diff --git a/src/tree_schema.c b/src/tree_schema.c
index c4eb258..d332d1f 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1107,10 +1107,12 @@
}
if (mod && unres->count && resolve_unres_schema(mod, unres)) {
+ unres_schema_free(ctx, unres);
lys_free(mod, 0);
mod = NULL;
+ } else {
+ unres_schema_free(ctx, unres);
}
- unres_schema_free(ctx, unres);
return mod;
}
@@ -1137,10 +1139,12 @@
}
if (submod && unres->count && resolve_unres_schema((struct lys_module *)submod, unres)) {
+ unres_schema_free(module->ctx, unres);
lys_submodule_free(submod, 0);
submod = NULL;
+ } else {
+ unres_schema_free(module->ctx, unres);
}
- unres_schema_free(module->ctx, unres);
return submod;
}