diff mbox

[FFmpeg-devel,5/8] avformat/mxfdec: Clear metadata_sets_count in mxf_read_close()

Message ID 20191031175830.24895-5-michael@niedermayer.cc
State Accepted
Commit 13816a1d085fdb6598ea6dc92ed3a1e6aff0cc1f
Headers show

Commit Message

Michael Niedermayer Oct. 31, 2019, 5:58 p.m. UTC
This avoids problems if the function is called twice

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mxfdec.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tomas Härdin Nov. 6, 2019, 8:34 p.m. UTC | #1
tor 2019-10-31 klockan 18:58 +0100 skrev Michael Niedermayer:
> This avoids problems if the function is called twice
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mxfdec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index f3b1b704f9..68a670154b 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -3582,6 +3582,7 @@ static int mxf_read_close(AVFormatContext *s)
>      for (i = 0; i < mxf->metadata_sets_count; i++) {
>          mxf_free_metadataset(mxf->metadata_sets + i, 1);
>      }
> +    mxf->metadata_sets_count = 0;
>      av_freep(&mxf->partitions);
>      av_freep(&mxf->metadata_sets);
>      av_freep(&mxf->aesc);

Looks OK, but I'd work out why close() is called twice

/Tomas
Michael Niedermayer Nov. 7, 2019, 5:04 p.m. UTC | #2
On Wed, Nov 06, 2019 at 09:34:01PM +0100, Tomas Härdin wrote:
> tor 2019-10-31 klockan 18:58 +0100 skrev Michael Niedermayer:
> > This avoids problems if the function is called twice
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/mxfdec.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > index f3b1b704f9..68a670154b 100644
> > --- a/libavformat/mxfdec.c
> > +++ b/libavformat/mxfdec.c
> > @@ -3582,6 +3582,7 @@ static int mxf_read_close(AVFormatContext *s)
> >      for (i = 0; i < mxf->metadata_sets_count; i++) {
> >          mxf_free_metadataset(mxf->metadata_sets + i, 1);
> >      }
> > +    mxf->metadata_sets_count = 0;
> >      av_freep(&mxf->partitions);
> >      av_freep(&mxf->metadata_sets);
> >      av_freep(&mxf->aesc);
> 
> Looks OK, but I'd work out why close() is called twice

I dont think i saw a case where it was called twice, i just felt
that its more robust to clear this

thx

[...]
Michael Niedermayer Dec. 1, 2019, 2:32 p.m. UTC | #3
On Thu, Nov 07, 2019 at 06:04:04PM +0100, Michael Niedermayer wrote:
> On Wed, Nov 06, 2019 at 09:34:01PM +0100, Tomas Härdin wrote:
> > tor 2019-10-31 klockan 18:58 +0100 skrev Michael Niedermayer:
> > > This avoids problems if the function is called twice
> > > 
> > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > ---
> > >  libavformat/mxfdec.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > > index f3b1b704f9..68a670154b 100644
> > > --- a/libavformat/mxfdec.c
> > > +++ b/libavformat/mxfdec.c
> > > @@ -3582,6 +3582,7 @@ static int mxf_read_close(AVFormatContext *s)
> > >      for (i = 0; i < mxf->metadata_sets_count; i++) {
> > >          mxf_free_metadataset(mxf->metadata_sets + i, 1);
> > >      }
> > > +    mxf->metadata_sets_count = 0;
> > >      av_freep(&mxf->partitions);
> > >      av_freep(&mxf->metadata_sets);
> > >      av_freep(&mxf->aesc);
> > 
> > Looks OK, but I'd work out why close() is called twice
> 
> I dont think i saw a case where it was called twice, i just felt
> that its more robust to clear this

will apply

[...]
diff mbox

Patch

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index f3b1b704f9..68a670154b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3582,6 +3582,7 @@  static int mxf_read_close(AVFormatContext *s)
     for (i = 0; i < mxf->metadata_sets_count; i++) {
         mxf_free_metadataset(mxf->metadata_sets + i, 1);
     }
+    mxf->metadata_sets_count = 0;
     av_freep(&mxf->partitions);
     av_freep(&mxf->metadata_sets);
     av_freep(&mxf->aesc);