From 29667a2c2014a54cf05f8106c45ad78be5228fd0 Mon Sep 17 00:00:00 2001 From: Clément Bœsch Date: Sun, 31 Mar 2013 10:00:32 +0200 Subject: decimate: check for avctx ptr before closing. Fixes a crash init failed before setting avctx. --- libavfilter/vf_decimate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libavfilter') diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 630f3ba492..2410344176 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -148,8 +148,10 @@ static av_cold void uninit(AVFilterContext *ctx) { DecimateContext *decimate = ctx->priv; av_frame_free(&decimate->ref); - avcodec_close(decimate->avctx); - av_freep(&decimate->avctx); + if (decimate->avctx) { + avcodec_close(decimate->avctx); + av_freep(&decimate->avctx); + } } static int query_formats(AVFilterContext *ctx) -- cgit v1.2.3