[FFmpeg-devel] lavf/mxfdec: only call mxf_free_metadataset when ctx_size is != 0, otherwise ctx == mxf

Submitted by Baptiste Coudurier on July 6, 2018, 7:08 p.m.

Details

Message ID 20180706190807.78691-1-baptiste.coudurier@gmail.com
State Accepted
Commit b420fead53b1788dfa704a4bf4643a4a0787bb1d
Headers show

Commit Message

Baptiste Coudurier July 6, 2018, 7:08 p.m.
---
 libavformat/mxfdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer July 7, 2018, 12:42 a.m.
On Fri, Jul 06, 2018 at 12:08:07PM -0700, Baptiste Coudurier wrote:
> ---
>  libavformat/mxfdec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

should be ok

thanks

[...]
Baptiste Coudurier July 19, 2018, 3:29 p.m.
On Fri, Jul 6, 2018 at 5:42 PM, Michael Niedermayer <michael@niedermayer.cc>
wrote:

> On Fri, Jul 06, 2018 at 12:08:07PM -0700, Baptiste Coudurier wrote:
> > ---
> >  libavformat/mxfdec.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
>
> should be ok
>
> thanks
>

Applied.

Patch hide | download patch | download mbox

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c7f90b29f2..819e4dfeb9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2711,7 +2711,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;
         }
 
@@ -2720,7 +2721,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,