[FFmpeg-devel] [PATCH 2/2] avcodec: make avcodec_close() more tolerant.

Clément Bœsch u at pkh.me
Wed Sep 4 22:15:20 CEST 2013


On Wed, Sep 04, 2013 at 04:11:38AM +0200, Michael Niedermayer wrote:
> On Tue, Sep 03, 2013 at 10:32:49PM +0200, Clément Bœsch wrote:
> > See previous commit.
> > ---
> >  doc/APIchanges       | 3 +++
> >  libavcodec/utils.c   | 5 +++++
> >  libavcodec/version.h | 2 +-
> >  3 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 12b9af4..45965e9 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -15,6 +15,9 @@ libavutil:     2012-10-22
> >  
> >  API changes, most recent first:
> >  
> > +2013-xx-xx - xxxxxxx - lavc 55.31.101 - avcodec.h
> > +  avcodec_close() argument can be NULL.
> > +
> >  2013-xx-xx - xxxxxxx - lavf 55.16.101 - avformat.h
> >    avformat_close_input() argument can be NULL and point on NULL.
> >  
> > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > index 4e510e6..2be0eb5 100644
> > --- a/libavcodec/utils.c
> > +++ b/libavcodec/utils.c
> > @@ -2402,6 +2402,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
> >      if (ret < 0)
> >          return ret;
> >  
> > +    if (!avctx) {
> > +        ff_unlock_avcodec();
> > +        return 0;
> > +    }
> 
> probably makes more sense to check before the lock call
> otherwise should be ok
> 

Changed and applied, thanks.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130904/ef880a69/attachment.asc>


More information about the ffmpeg-devel mailing list