Skip to content

Commit 5d81a94

Browse files
committed
parser lyb BUGFIX proper cleanup
1 parent 30d2671 commit 5d81a94

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/parser_lyb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ lyd_parse_lyb(const struct ly_ctx *ctx, const struct lysc_ext_instance *ext, str
15621562
struct ly_set *parsed, ly_bool *subtree_sibling, struct lyd_ctx **lydctx_p)
15631563
{
15641564
LY_ERR rc = LY_SUCCESS;
1565-
struct lyd_lyb_ctx *lybctx;
1565+
struct lyd_lyb_ctx *lybctx = NULL;
15661566

15671567
assert(!(parse_opts & ~LYD_PARSE_OPTS_MASK));
15681568
assert(!(val_opts & ~LYD_VALIDATE_OPTS_MASK));
@@ -1571,17 +1571,17 @@ lyd_parse_lyb(const struct ly_ctx *ctx, const struct lysc_ext_instance *ext, str
15711571

15721572
if (!(ctx->opts & LY_CTX_LYB_HASHES)) {
15731573
/* generate LYB hashes */
1574-
LY_CHECK_RET(ly_ctx_set_options((struct ly_ctx *)ctx, LY_CTX_LYB_HASHES));
1574+
LY_CHECK_GOTO(rc = ly_ctx_set_options((struct ly_ctx *)ctx, LY_CTX_LYB_HASHES), cleanup);
15751575
}
15761576

15771577
if (subtree_sibling) {
15781578
*subtree_sibling = 0;
15791579
}
15801580

15811581
lybctx = calloc(1, sizeof *lybctx);
1582-
LY_CHECK_ERR_RET(!lybctx, LOGMEM(ctx), LY_EMEM);
1582+
LY_CHECK_ERR_GOTO(!lybctx, LOGMEM(ctx); rc = LY_EMEM, cleanup);
15831583
lybctx->parse_ctx = calloc(1, sizeof *lybctx->parse_ctx);
1584-
LY_CHECK_ERR_RET(!lybctx->parse_ctx, LOGMEM(ctx), LY_EMEM);
1584+
LY_CHECK_ERR_GOTO(!lybctx->parse_ctx, LOGMEM(ctx); rc = LY_EMEM, cleanup);
15851585

15861586
lybctx->parse_ctx->in = in;
15871587
lybctx->parse_ctx->ctx = ctx;

0 commit comments

Comments
 (0)