From 92e5414897707d998b4ba46664709347760f5b11 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 6 Dec 2011 19:54:03 +0200 Subject: ad_ffmpeg: avoid avcodec_close() if avcodec_open() failed Avoid calling avcodec_close() in uninit() if avcodec_open() failed. Calling avcodec_close() on a non-open codec context causes a crash with recent Libav versions. --- libmpcodecs/ad_ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index ae7f36b791..762c80282d 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -214,7 +214,7 @@ static void uninit(sh_audio_t *sh) AVCodecContext *lavc_context = ctx->avctx; if (lavc_context) { - if (avcodec_close(lavc_context) < 0) + if (lavc_context->codec && avcodec_close(lavc_context) < 0) mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n"); av_freep(&lavc_context->extradata); av_freep(&lavc_context); -- cgit v1.2.3