From b420fead53b1788dfa704a4bf4643a4a0787bb1d Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Fri, 6 Jul 2018 12:06:26 -0700 Subject: avformat/mxfdec: only call mxf_free_metadataset when ctx_size is != 0, otherwise ctx == mxf --- libavformat/mxfdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 996969d1ff..8d3e8ed4db 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2631,7 +2631,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF if (ctx_size && tag == 0x3C0A) { avio_read(pb, ctx->uid, 16); } else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0) { - mxf_free_metadataset(&ctx, !!ctx_size); + if (ctx_size) + mxf_free_metadataset(&ctx, 1); return ret; } @@ -2640,7 +2641,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF if (avio_tell(pb) > klv_end) { if (ctx_size) { ctx->type = type; - mxf_free_metadataset(&ctx, !!ctx_size); + mxf_free_metadataset(&ctx, 1); } av_log(mxf->fc, AV_LOG_ERROR, -- cgit v1.2.3