[FFmpeg-devel] [PATCH] Manage the case when the avctx provided to avcodec_close() is NULL.

Stefano Sabatini stefano.sabatini-lala
Sun Dec 5 01:54:02 CET 2010


On date Sunday 2010-12-05 01:17:16 +0100, Michael Niedermayer encoded:
> On Sat, Dec 04, 2010 at 07:38:47PM +0100, Stefano Sabatini wrote:
> > ---
> >  libavcodec/utils.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> when is it NULL?

static av_cold void uninit(AVFilterContext *ctx)
{
    MovieContext *movie = ctx->priv;

    if (movie->codec_ctx)
        avcodec_close(movie->codec_ctx);
    if (movie->format_ctx)
        av_close_input_file(movie->format_ctx);
    av_freep(&movie->frame);
    if (movie->picref)
        avfilter_unref_buffer(movie->picref);
}

with the patch you don't have to check for movie->codec_ctx, same for
the the other patches (it was your idea to add these NULL checks), but
I can happily live with those additional checks...
-- 
FFmpeg = Faithful and Fabulous Muttering Ponderous Enhanced Generator



More information about the ffmpeg-devel mailing list