lyb parser BUGFIX return value fixed
Even if the parser context is not returned,
the function should succeed if ret is 0.
@@ -1091,13 +1091,15 @@ lyd_parse_lyb_(const struct ly_ctx *ctx, struct lyd_node_inner **parent, struct
}
cleanup:
- if (ret || !lydctx_p) {
- lyd_lyb_ctx_free((struct lyd_ctx *)lybctx);
if (ret) {
+ lyd_lyb_ctx_free((struct lyd_ctx *)lybctx);
lyd_free_all(tree);
- }
} else {
+ if (lydctx_p) {
*lydctx_p = (struct lyd_ctx *)lybctx;
+ } else {
+ lyd_lyb_ctx_free((struct lyd_ctx *)lybctx);
+ }
if (tree_p) {
*tree_p = tree;
}
